Is it possible to integrate maps in Cytoscape.js? - maps

I am currently using cytoscapeJS to visualize a network but I would like to overlay the graph on a map and plot the nodes to specific locations. The Tokyo Railways Demo is similar to what I have imagined but the background is black.
In a perfect world I could dynamically calculate the longitude and latitude from the node's address data (but I guess this would require cytoscape to have geocoding capabilities) and then plot that on a map.
Here's an example of what I'm trying to do: http://xliberation.com/googlecharts/d3flights.html

Related

Cesium Draw and Measure tools for 2D maps?

I am using Cesium to display a strictly 2D map in the browser (wrapped in React using the Resium library).
I am interested in giving the user the option to draw lines\polygons, and to measure the distances between two points or the area withing the polygon.
Basially, I want precisely this OpenLayeres example, but in Cesium: https://openlayers.org/en/latest/examples/measure.html
How would one go about doing it?
Thank you
I was doing some research on cesium drawing tool library.
It wasn't same as the one you asked but you can use it for your need. you can use for 2D and 3D maps. it gives all basic functionalities like draw circle, polygon, add marker, draw line, calculate distance etc.
I have found cesium-draw the library for the VUE.
[cesium draw ](https://www.npmjs.com/package/cesium-draw)<br>
If you can work with Angular their is a lot of cesium sport in angular so you can use
[angular-cesium](https://angular-cesium.com/)
if you have found any thing else please do share I love to see.

How do I load/parse a SceneKit .scn file into my Metal app?

I want to create a 3D scene with the SceneKit modeler and then read it into my Metal app. I see there is SceneKit and ModelIO API to do this but I am unclear on how the pieces fit together.
So, what I need is path from .scn file -> MDL Mesh -> geometry + texture. I am unclear on how I would sync my Metal shaders with materials created in the SceneKit modeler.
There's two main parts to what you're asking here: getting SceneKit data into ModelIO, and rendering ModelIO data with Metal.
To get SceneKit scenes into ModelIO, first use SceneKit API (SCNScene or SCNSceneSource to load the .scn file, then use ModelIO API to get the objects you want as meshes. You can create a MDLAsset from the entire scene using assetWithSCNScene:bufferAllocator: and then walk through the asset's object hierarchy in ModelIO to find the mesh you want, or walk through the node hierarchy in SceneKit to find the SCNNode or SCNGeometry you want and then get the mesh to ModelIO using objectWithSCNNode:bufferAllocator: or meshWithSCNGeometry:bufferAllocator:.
As for using ModelIO meshes in a Metal app, Apple has a sample code project that shows how to use ModelIO to load an OBJ mesh, use MetalKit to get the mesh data into Metal GPU buffers, and hook up the material information you get from ModelIO to shader variables for use in your own renderer.
You should be able to put the two of these together: where the sample code loads an OBJ to get a MDLAsset or MDLMesh, use the methods in (1) to get an asset or mesh out of a SceneKit file instead.
The SceneKit material model is of course much more complicated than the simple Phong shader used in the sample code. But the sample code does show how to iterate through a MDLMaterial's properties and set corresponding arguments in a Metal shader — if you create a more complicated shader, just follow the same steps to map the material properties to whatever your shader's inputs are.

Mapping Lat And Lon on a blank page

VB.net, WPF
Been researching for a while and come across nothing that is exactly what im looking for
Basically I am required to make a program that can map area covered by a machine this map can be either be a polygon covering a white screen or a polygon overlaying an offline satellite/Street map.
I have the NMEA serial GPS setup and running perfectly however I am now required to store the Lat and lon data of the machine for each second tick and then overlay this as a polygon map for area covered.
The machine width will be set by the user and map area covered with the GPS.
My Question.
Is there a way I can overlay a gps generated coverage map on either a white screen or an offline street map?
I think I understand what you're trying to achieve here.
You can draw the coverage of your machine as a circle of machine width on a canvas. See here for a tutorial
When it comes to converting your lat/long to pixels for the centre of your machine you need to account for the projection of the chart. Lat/Long describes a location on the surface of a sphere. However your map is a flat 2d shape. To enable us to plot these points the maps are squished using a projection, the most common of which is the mercator projection
Here's an example of transforming lat / long for mercator: Covert latitude/longitude point to a pixels (x,y) on mercator projection

Plot a known pixel (x,y) from original image using custom Bing Maps WPF tiles

I am trying to use the Bing Maps WPF control to render custom map tiles from an image of a fictional game world map, but I also need to plot X,Y values on the map from the original world image (sort of like an in-world GPS).
The image is 5720x5720 and I already have working (in a different application) a function that manually crops, scales and redraws sections of the image and plots the pixelX and pixelY coordinates in a PictureBox. I would like to get the same functionality working using the map control.
I used this Photoshop plugin to cut the tiles from the original custom image (works like maptiler for google mapes)
https://github.com/bramus/photoshop-google-maps-tile-cutter/
The problem is I know the X,Y values to plot from the original image, but I'm not not quite sure how to calculate Lat/Long for drawing a point in the custom tile system.
<m:Map Name="Map">
<m:Map.Mode>
<!-- set empty map mode, i.e. remove default map layer -->
<m:MercatorMode/>
</m:Map.Mode>
<local:MyTileLayer UriFormat="file:///C:/map_tiles/{z}_{x}_{y}.jpg"/>
</m:Map>
The map is displaying great and everything looks fine using the custom map tiles. I found this link that provides a class for converting PixelXY to LatLong in the TileSystem, but they are all for realistic world points.
https://msdn.microsoft.com/en-us/library/bb259689.aspx
My custom map tiles are actually for a fictional map for a game so I don't believe the projection and earth-curvature calculations are needed in my situation.
How might I go about plotting a point accurately in the Bing Maps WPF control if I only know the X,Y pixel coordinates from the original untiled image?
Given that your 5720x5720px map image covers the standard Bing Maps (or Google Maps or OpenStreetMap) coordinate range of longitude = -180..180 and latitude = -85.0511..85.0511, the following method would convert from image pixel coordinates to lat/lon according to the Mercator projection:
public static void PixelXYToLatLon(
double pixelX, double pixelY, out double latitude, out double longitude)
{
var imageSize = 5720d;
var maxLatitude = 85.05112878; // = Math.Atan(Math.Sinh(Math.PI)) / Math.PI * 180d;
var y = (0.5 - pixelY / imageSize) * (2d * maxLatitude);
latitude = Math.Atan(Math.Sinh(y * Math.PI / 180d)) / Math.PI * 180d;
longitude = (pixelX / imageSize - 0.5) * 360d;
}
The imageSize variable might of course also be a method parameter.
If you use MapTiler (http://www.maptiler.com) to create the tiles you have two ways how to achieve what you want:
A) Map your game map to the artificial world with Lat/Lon coordinates
In this case you will map the world coordinates to your pixel coordinates. The tiles must be prepared in a correct way, same as those for real world maps.
To create the tiles with MapTiler you should follow this steps:
Choose "Mercator tiles" in the first step
Drop in your image file
Choose "Web mercator (EPSG:3857)" in the dropdown in the "Coordinate system" dialog - it is a square image of the whole world and you don't want to deform it.
Choose "Bounding box (West South East North)" in the dialog "Geographical location" and copy&paste in the input the world coordinates: "-20037508.342789244 -20037508.342789244 20037508.342789244 20037508.342789244"
Render the tiles
With this approach you can load the tiles in your Bing Maps WPF control and position the markers or other data by using Lat/Lon coordinates.
The point [0,0] is going to be center of the image, and you can calculate the other lat/lon coordinates appropriately.
See this page and source code down on the page:
http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
The globalmaptiles.py code embedded in the page is available in different languages including C# (.cs) if you need it. It has been ported by other people from our code.
B) Stay in raster coordinates
A different approach - where you create the map tiles in the original raster coordinates of the input file. There are no Lat/Lon involved, coordinate system is in pixels and you can draw markers and polygons in pixel coordinates as well. MapTiler gives you sample JavaScript viewer in Leaflet and in OpenLayers. Other viewers you have to patch yourself for using with pixel coordinates. To generate the tiles just choose "Raster tiles" - as in this tutorial: http://youtu.be/9iYKmRsGoxg?list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay
I expect the tiles made with your Photoshop plugin are going to be similar to the raster coordinates made with MapTiler.

Custom Map Image WIndows Phone 7

I have custom map image with specific height and width.
i need to map x-y coordinates of image to latitude longitude from four corner latitude longitude available.
this requirement is for fulfill current location of user into custom image map.
more on this on image i have specific few points on image, based on current position of user, i need to find near by point on image in Windows Phone Application.
Thanks in advance.
If you are using the Bing Maps Silverlight Control for WP7, there are APIs for want you want to achieve.
The Map class for example provides methods LocationToViewportPoint and ViewportPointToLocation for converting coordinates.
There is also the class MercatorUtility which provides helpful methods like LocationToLogicalPoint and LogicalPointToLocation.
However, depending on what you mean with custom map image, nobody except you would possibly know how it maps to view coordinates.

Resources