How to generate a polygon around a GeoJson point in web mercator projection - geojson

I am building a tool to display markers on a map at varying heights in Mapbox GL Js. Mapbox currently lacks the ability to give a marker a height, and the geoJson point is not rendered on its own.
How can I generate a hexagon around a GeoJson point that will follow the EPSG:3857 projection, for me to render on my map?

You don't need to worry about the projection - Mapbox GL JS will project it for you.
You may be able to use Turf's hexGrid method to generate a single hexagon.

I found that Turf.js was all I needed. There is a circle method that will generate a polygon around a point taking in a number of steps and radius.

Related

How to draw curved polygon in ARKit?

need to draw curved polygon in ARScene like on a picture
Using swift code only.
Any ideas ?
You can draw a curved Polygonal Model in ARKit/SceneKit using several polygons, not single one. For nice curvature 30 to 100 polygons needed.
But if you meant whether ARKit/SceneKit supports NURBS Models like Maya or 3dsMax does – the answer is NO. You have an API only for Poly Modeling.
For further information please read the following SO post.

How do I use a web mercator projection map for SCNMaterial on an SCNShere geometry?

I have a simple globe view in my app. Previously we were using WhirlyGlobe, but have opted to use SceneKit instead. Everything works great and we are happy with it EXCEPT we used map tiles in Whirly Globe and the do not work (as far as I can tell) in SceneKit. We want to use that map (tiled, split or as one file) on an SCNSphere geometry.
I copied the satellite map that Apple uses in their documentation and it looks right, but is not the map we need. Our map is in web/sphere mercator projection and it looks bad in SceneKit on my sphere.
I do not* know what the 2x1 projection Apple is using is called, so JUST that information might be enough for me to find the solution.
I do now:
Equirectangular - RIGHT after I posted of course.
Also known as Platte Carre (per Hal Mueller's comment)
An export of our map in the web mercator projection is 1x1. Just squishing it in the vertical axis does not work (SceneKit does this automatically anyway).
I can convert the file programmatically, using a tool or some hybrid if needed.
If needed, I can provide thumbs of the map skins.
If you already have images and need to reproject them (say from Mercator to Plate Carree/Equirectangular), take a look at GDAL (http://www.gdal.org). In addition to the format conversions, it contains a reprojection library. GDAL runs on most systems, and can be used from the command line or bundled into other programs.

Can I draw great circle segment (geodesic) lines in Openlayers 3?

I want to plot lines between (distant) points on an Openlayers 3 map (which uses Open Street Map tiles). I want the lines to be seen as curves, as with flight paths, since they should take the shortest real world surface path: a geodesic (a great circle segment).
Is this possible?
Would I need to interpolate the points along the geodesic (how?) and plot a bunch of line segments, or is there an easier way? Is there something built in I can't find, or a library for it?
Looking at OL3's Flight Animation Example, it appears to be possible using the arc.js plugin: “A great circle arc between two airports is calculated using arc.js and then the flight paths are animated with postcompose. The flight data is provided by OpenFlights (a simplified data set from the Mapbox.js documentation is used).”

How to implement measure functionality on map

I'd like to implement Measure functionality on openstreet map. Measure is adding two points on a map and find the distance between those points.
For that I referred https://github.com/danstowell/openstreetmap-website/commits/jsrouting-contextmenu
It will work fine except water area/region on openstreet map. In my case I am rendering my own maps on my project, so this is not work for me.
I am using below Environment:
Environment : Rails 4 and Ruby 2
Anyone know about it?
How do I implement measure functionality on my map?
Is there any other ways to implement this?
Not sure on the specifics relating to OSM, however assuming that you can convert the points to geodetic points then you can use the haversine or vincenty formulas to get the great circle distance:
http://www.movable-type.co.uk/scripts/latlong.html
OSM uses a spherical Mercator projection. If all you have are 2d Cartesian (projected) coordinates then you will need to convert these to geodetic coordinates.
If you also need to take into account terrain then this gets more complex but maybe OSM provides something for this that gives heights along a transect line.

Is there a possible way to extract coordinates within a polygon in Google Earth?

is there a way to extract coordinates inside a polygon in Google Earth. For example I have a project in which I need to use the coordinates for every 1km^2 in an area and use them in MATLAB. How can this be done?
While you could use Google Earth to overlay polygons and a grid of coordinates and visually determine your answer, Google Earth does not provide a way to select and export features (grid points) within another feature (a polygon).
However, you could approach the problem by:
1. saving the polygon feature to a KML file;
2. parse the KML file using an XML reader in your favorite language;
3. construct a grid of coordinates that you want to test;
4. use a library (such as JTS in Java, GEOS in C, Shapely in Python) that implements a point-in-polygon algorithm. MATLAB appears to provide a point in polygon function.

Resources