Bing Maps REST can't draw polygon with console app - rest

As a console app, I'm creating maps with Bing Maps, with lat/lon and pushpins. Saving as a jpg. Everything is working great. NOW, however, I'd like to draw a polygon layered on said map[s]. It seems this might not be possible; I cannot find the answer. Dynamic via web page it seems is the only way; I need it to happen with a console app.

The custom polygon as well as custom polyline are not supported features on the REST service.
Since you're in a console application and as you're saving the image as JPG file, you can draw your own content onto the image using GDI or other technology to manipulate the image directly. Currently, there is no other way.

Related

Mapbox Android SDK - querySourceFeatures at a given coordinate

I use Mapbox Tileset API and generated a custom tileset (it's a huge 400MB of GeoJSON data) uploaded to Mapbox servers, and added to our style in the studio as a custom fill layer.
This way I can show our custom areas (as polygons) of the world with green (visited) and red (remaining) locations with using expressions only.
I would like to tell if a point (GPS coordinate) is within a polygon of the tileset source/layer and which one, even if the app is in the background (GPS tracking is running in the background and I would like to notify the user when they are within a polygon).
Using queryRenderedFeatures would be great, but unfortunately, it doesn't work when the app is in the background or the user's position is outside of the current viewport.
Is there any solution to get the list of the features at a GPS coordinate even if it's outside of the viewport?
Another requirement is that, it should work when the device is offline, so the Tilequery API won't help.
Downloading the offline data of our style with a limited zoom range working perfectly, I can see my custom source-layer (polygons) even if the device is offline.
So I think there should be a way to query the tileset-source when the device is offline too.
Currently, I generate a simplified GeoJSON file and use it with turf#points-within-polygon when the device is offline, but there're gaps, sometimes polygons are covering each other (due to the simplifying) etc... if I make the tolerance level lower the file is going to be too large to download and store it offline, so this is not really a solution just a poor workaround.
Can I make a PIP (point-in-polygon) query for a custom Tileset source even outside of the viewport, when the app is in the background and the device is offline?
Assuming this is your actual question:
Can I make a PIP (point-in-polygon) query for a custom Tileset source even outside of the viewport, when the app is in the background and the device is offline?
If the device is offline, then any solution that requires fetching tiles on demand (like a tileset in Mapbox-GL or TileQuery) is out.
You said storing the whole GeoJSON is out, because it's too big.
I think the remaining solution is to generate a single-zoom-level tileset and store it locally, then query it with something like query-mbtiles.

Custom drawing layer in Mapbox GL JS (and Leaflet)

I'm starting research to add a user feature to an existing map built in Mapbox GL JS (wrapped in an Angular 2+ application). What I need to do, is allow a user to be able to draw and rotate ellipses and text labels over the top of a map, and be able to save screen captures of the result.
I'm coming into this with no experience in Mapbox or Leaflet, so I have a lot to figure out. My first goal is to determine if I can do this in Mapbox directly (with a plugin?), of if I will need to render a canvas over the top of my map with some third-part drawing library (I have a lot of experience with those).
The obvious advantage to doing this in Mapbox directly would be that we might still be able zoom and pan.
The Mapbox-gl-draw library lets the user author features in a map, but probably not to the extent you need.
If the features the user creates don't need to live "in map space" (ie, the map is static, and the labels are statically positioned over the top, for printing), working directly on a canvas will give you much more flexibility. You'll also have access to a much wider variety of libraries.

What does the painting of the leaflet-described elements on a map?

I'm using Leaflet + CartoDB; I've also used Leaflet + Mapbox; and there may also be some Leaflet + GoogleMaps in my future.
My customer asked me this question: where do the Leaflet layers get painted onto the tiles? Is that done by Leaflet? Or by the Tile engine?
Does this change if I'm using a "regular" map engine (such as Mapbox) or if I'm using something like the KML-rendering plugin?
where do the Leaflet layers get painted onto the tiles? Is that done by Leaflet?
By default (unless you're doing something weird), that happens in your web browser, which is compositing DOM elements on top of each other. You can check this by using the developer tools in your browser and inspecting the DOM elements for the tiles, and the <canvas> or <svg> with your vector geometries. They are separate DOM elements, thus your browser is doing the compositing.
Does this change if I'm using a "regular" map engine (such as Mapbox) or if I'm using something like the KML-rendering plugin?
Not really. Mapbox-gl-js uses insane amounts of WebGL, so that means that the brunt of the workload moves from the browser's compositor to a WebGL stack. It still happens in the web browser, albeit in a different part of the browser.
There is no "KML rendering plugin" for leaflet, just KML loading plugins. Vector geometries are still rendered in a <canvas> or <svg> separate from the image tiles for the basemap, then composited.
You can, of course, run your own tile server (with software such as Geoserver, Mapserver, Mapproxy, mapnik+mod_tile, tirex, tilestream, or dozens of others). In that case, you obviously know you are rasterizing your data into tiles.

Use an Image as an MKOverlayView (iPhone MKMapKit)

We want to use MapKit / MKOverlayView to create a map that looks totally customized. We would create a PNG that has the local streets / points of interest, and match that up to MapKit map.
I am finding some info that seems to infer that this is possible, but all the tutorials and examples I find are dealing with drawing lines and polygons, which is not what we want.
I have also considered the possibility of creating the PNG, grabbing the user's location and mathematically calculating their position on the image... but that seems like a bigger task than potentially using a MKOverlayView
Any ideas about how to get started would be much appreciated.
You could start by looking at Open Maps I believe you can customise their maps by creating your own XML file (different styles of roads etc..) You can then download the map tiles as PNGs or lazy load them in your app.
Google maps on the other hand you are not allowed to modify or store in you application.
However if you choose the open maps approach you have to effectively roll your own MapKit. This is tricky but very much possible. Start by looking at the apple developer videos on tiled scroll views.

iPhone - Image overlay MapKit framework?

I can see with iOS4 you can now tile an image on google maps (Been looking at the TileMap example from apple). This is great as this is what I want to do, but from what I can see I need to know the GEO reference of the image so I can raster the images with the appropriate zoom levels, etc. What I have is an artist image, which is a map of a specific area and I want to overlay this image on google maps.
Am I missing something here, but can this be done with a none standard map and having different zoom levels?
The main reason why I need to use google maps is because of the GPS functionality, so the user will know where they currently are on the map.
Georeferencing is how you "pin" your image to the world. It is a tricky process, but not too hard once you dig into it.
You've already found the TileMap example code - that is the first step.
Next, check out MapTiler.org. There you will find links and some binaries that you can use to process your image into georeferenced tiles.
If you don't know the lat/long coordinates for your image, you can use Google Earth to interactively overlay the image onto the map, and then copy the coordinates out.
Good luck!