I don't understand the difference between
https://developer.here.com/documentation/examples/rest/map-image
and
https://developer.here.com/documentation/examples/rest/map-tile
Can someone explain it to me?
The main key difference is that the rendering process. In map image everything happens at the server side(HERE) and in response the only image will be sent back, whereas in map tiles the row data in the JSON format is returned and the rendering of row JSON data happens at client side.
The other key difference is The Mercator Projection, The HERE Map Tile v2 serves map tiles obtained by mapping points on the surface of a sphere (the globe) to points on a plane, using the normalized Mercator projection. For other details please refer the below dev guide.
https://developer.here.com/documentation/map-tile/dev_guide/topics/quick-start-dhc.html
https://developer.here.com/documentation/map-image/dev_guide/topics/display-options.html
Related
I am currently investigating the possibility of utilising the HERE APIs as source data inputs into possible solutions we would like to develop as a company on ESRI.
I understand that any data we retrieve from the API, i would need to create ESRI objects on the fly, and add them to an ESRI map layer.
However, one thing that is not clear in my mind, is how to calculate the tiles for my particular map extent.
The REST API specifies some base information, regarding calculating tiles based on lat lon - but what is the lat/lon of? is the map center? is it the bottom left or bottom right?
Are there any JS helper methods that HERE have, that would calculate the tiles required for a particular extent?
Are you referring to this documentation part: https://developer.here.com/documentation/map-tile/common/map_tile/topics/mercator-projection.html ?
It is the coordinate of the part of the map which you want to display e.g. the center of your map view.
I'm using the Here.com "maptile" api to populate my map with map tiles. Now I want to add routes from point A to B to the map. I figured Here's routing api would provide me with a nice set of coordinates to use for plotting a line in the map, but the api only provides one coordinate pair per "maneuver" (that is, at roundabouts, exits, intersections etc). That is not detailed enough to use for plotting routes since all roads are not perfectly straight ;)
Example
This example at Here's api playground shows a red route plotted perfectly along a road using their map image api. However, if you run the start and end coordinates in the "m1" field through the routing api, you will get the following coordinates:
52.5408395,13.2626364,52.5403011,13.2630944,52.5289285,13.2687593,52.51873,13.2800306
If you enter these coordinates in the "r1" field and click Send Request, you will see that the route is plotted differently (straight line across the park, instead of along the yellow road).
Question
Is there any way to get more detailed data from Here.com's routing api (or any other Here api I may have overlooked), suitable for plotting roads?
Or is there perhaps some way to get map tiles from the maptile api with a route properly pre-rendered?
In HERE Routing API, you can ask for route shape with parameter &routeattributes=shape
This will return an array of coordinates which represents the exact shape of the route on the road. You can also use pedestrian mode which will take into account the roads only accessible on foot.
Unfortunately it's not possible to get map tiles with rendered route shape using Map Tiles API. This API is just for fetching tiles.
I need a polygon for every German state. I go all the GeoPoints in one JavaScript-file but the file is because of the amout of points about 4MB. I've been googling and thinking about this problem all day but couldn't figure out a solution...
How can I use Google Maps polygons without forcing the user to download a huge js-file with the coordinates?
Thanks!
Ron
You can encode the polygon points to vastly reduce the size of the javascript file. To do this, you must include the geometry library.
https://developers.google.com/maps/documentation/javascript/reference#encoding
https://developers.google.com/maps/documentation/javascript/geometry#Encoding
One option is to use a FusionTablesLayer to display the polygons. They are available in the Natural Earth data set that is publicly available.
Example
You could do the same with your points and a KmlLayer if you convert your data to KML.
Well... somehow the points have to get to the user. You could think of the following solutions to reduce the data usage:
Use different polygons for different zoom levels. For example zoomed out you won't need the full details.
only send parts of your polygon back to the user. You can for example send the viewport coordinates to an AJAX script. This one queries your database and/or shapefile and only returns the polygon parts that are visible in the user's viewport
preprocess tiles. If you can generate images from your shape, you can overlay these on Google Maps.
I am making a Google Map (API v3) that searches within a given neighborhood. The neighborhood is not a square but a ton of different points to make a polygon bounding box. I know how to make the polygon but not sure how to get it to search only within the polygon. Below you can see I am using a radius from my center location but I don't need a radius but only a given location.
var request = {
location: centerLatlng,
radius: 800,
types: ["school", "church", "park", "university"]
};
I'm guessing this is a places API request?
https://developers.google.com/maps/documentation/javascript/places
The API doesnt support passing in a artbitary polygon. If you really need to search as such, will just have to do a circle search (as in your example) - and then discard and results that are not in your shape.
Dont think there is a 'is point in side polygon' test in the Maps API itself, but can find code online
https://www.google.com/search?q=point+in+polygon
I have trouble finding any information on how to use the API to:
Search for streets and get some clickable results that returns a LatLng object or something (at least coordinates). So If I search for a street and click on a result, I'll pan to that street (for example).
How can I calculate distance between markers? and possibly, draw lines between them.
All I get is the API but no guides so it's fairly hard figuring out what types to use.
Here is a fiddle showing how this can be achieved:
http://jsfiddle.net/foxwisp/vQGMr/1/
To convert street names to lat/lng you need to use a Geocoder such as the one provided by Google Maps API.
Then, when you get back the results from the geocode, you use the lat lng properties to create a marker. Once your first marker is placed, you repeat the process for your second street address. We nest these calls so that we can be assured of the order of execution due to their asynchronous nature.
Once we have our second marker we use Google's polyline function to draw a line between the two latlng marker points.
Then we use a slightly complicated mathematical equation to do some distance calculations and voila.
The Google Maps API is fantastically documented, hopefully this fiddle will put it into context for you and you can explore each element step by step by reviewing functions and properties in the documentation