Google Maps API v3 my map does not center on kml polygon - api

my problem is all in the title, I built a map with a center and zoom and I load a kml file representing a specific area according to the user's choice. It works fine, except that my map does not auto center and zoom on the loaded polygon. It zooms but only the upper part of the polygon is visible. The PreserveViewport option does not help me more as I set it to true I don't get any change as expected... Maybe is there a way to get the kml polygon's center in order to re-set the map's center ? I've browsed the web with no success. You can have a look here

Actually working, forgot tu update my css for map in order to get it show entirely. Thanks again, you saved me lots of time.

Related

Bing maps v8 pin position is off when zoomed

I am using Bing Maps V8 web API. It works fine when using all latest version of modern browsers. It does not plot the pins correctly. The pins are off from the original position.
Zoomed in:
Zoomed Out:
All of the pin locations are supposed to be inside the land area. But when zooming out, the pin never updates its location.
Is there anything I am missing? Is there any update event to be fired when map zooms?
Thanks
Senthil S
To fix the issue, I had to add the "anchor" to options when creating Pushpin object as said in this post
Properly Anchoring Pushpins

Gray out entire map except a portion in Google maps iOS

I am using Google maps in iOS using iOS SDK, letting users mark an area using few markers, creating a polygon.
I want to highlight that area and gray out the rest of the map, something like this:
Is this possible somehow?
You have to draw your own UIImage where you create the gray area, clear area, and polygon borders. After that add it as an overlay tile using GMSGroundOverlay. This will fix it in place for when the user scrolls.
https://developers.google.com/maps/documentation/ios/overlays
This is similar to how radar overlays are drawn for weather apps.
I would approach this problem using several steps.
1) collect your points from the user that will define your polygon.
2) send the collection of points to your server.(ajax post)
3) server side, dynamically create a grey image with a transparent hole in it that is your polygon.
4) store image on server, send back response with info telling browser how to retrieve it(url,id,whatever).
5) using javascript + google maps api, apply an overlay referencing your newly created image.
each step may have its challenges but the problem becomes manageable if you focus on the different steps.
1) and 2) will involve using javascript, capturing 'clicks' and having feedback to the user in the form of a line or something on the map. Once finished, the server call can be initiated by the user or by your programming.
3) I would use python with an image library(skimage, etc.) and a mapping library (gdal). Making an image is not hard but combining it with GIS and getting the right projection, etc. will take some fiddling.
4) shouldn't be a problem once you've got that far.
5) using zimmryan's comment about creating a ground overlay could be helpful for this step.
good luck!

Can I cache Apple Maps?

So here is the scenario,
I am working on this piece where direction tab holding the map and there is a pin on address and callout bubble is automatically been shown as view appears. if you click button get driving directions it take user to apple maps for direction.
As this map is static I was thinking instead of download every time on when view appears, Is it possible to Cache the map, let say 1 sq Kilomerters or the area which is shown in the view.
Apple caches the map for you.
If the user will not load other map data, it will be in the cache.
You cannot force your part of the map to stay in the cache.
Edit:
I tried it with disabling wlan, so the device cannot load the map data anymore from net. It looks like it is loading, but this is more a building up ob the map data.
it shows the map data previously loaded, but cannot load new one.
No, there is no way to control the caching in MapKit. Check out the Mapbox iOS SDK or MBXMapKit.

Custom icons on google map not drawing correctly

I'm having problems with google maps, drawing icons was working fine few weeks ago in my project. At some time the icons are very frequently drawing in partly and I don't know what is causing it. It is both happening on my development machine and production server and on all machines.
I'm only using two different icons so I know the bitmap images are not corrupt.
Here below are two sample images.
You'll get more help if you post your outputted JSON. Your gmaps JSON must not have quotes around width or height, like so: "picture":"/assets/dayhome.png","width":32,"height":37,"lat":53.5402,"lng":-113.628
Another fix is to include optimized:false which disables the html5 canvas (the squares that are cutting off the markers).
My much more detailed analysis here: Canvas Tiles Cut Off Custom Markers
Set optimized:false in your Marker options.
If optimized is true (the default), then your marker images are incorporated into the tiles. Unfortunately where markers cross tile boundaries, they are not also used on the adjacent tile, so appear to be truncated at the edge of the tile. Using optimized:false forces the icons to be placed on the map as separate DOM objects.

Is it possible to animate markers in ArcMap?

I'm completely new to ArcGIS and ArcMap, but someone suggested this program to me for a project I'm working on.
I would like to animate individual entities on a map, and was wondering if it is possible to do so in ArcMap. I asked this earlier here and a member directed me to a tutorial on animating in ArcGIS. The animation in the guide was over a map spread (ie. each pixel on the map displays, say, a different color to indicate population data in the area). However I realized that if I zoom in a lot, eventually the image will degenerate into pixels, which is why I need an actual object to mark a certain point. I checked some online tutorials and it seems like we can place markers on the map. Can someone tell me if it is possible to animate these markers (for example via a for-loop)? And if so, could you point me in a direction where to start?
Thanks in advance!
You can animate layers in ArcMap is the short answer. Its not as simple as using the timeline feature in Google Earth for example though. But then ArcMap is much more than just a visualization tool.
This help page on the ESRI web help looks like a good place to start.
I'm not 100% sure what you mean by the image degenerates into pixels. Are you saying that the markers were single points in the layer. Unlike Google Earth you are not confined to simply plotting points on the map. You can draw completely arbitrary shapes in ArcMap, which can be defined to cover actual areas of the map, so when you zoom-in the shape gets larger.
The way you need to load data into ArcMap to produce an animation isn't too simple. There might be other ways to do this, but the way I know of is to generate a NetCDF file. This file contains a 3D matrix of layer data, where each layer is separated through time. Because you generate a matrix, you are effectively placing a raster image over the map. Thus if you want to cover a large area, each matrix becomes large, and you multiply that by the number of time slices you wish to animate over.
Once you have a NetCDF file with your data in however, getting ArcMap to animate it and produce say a .avi file is pretty simple.
You could try just loading some of the example NetCDF datasets into ArcMap to see how/if they will work to get you started.
Hope that helps.
The upcoming v10 will have better time-aware capabilities, which will allow for animation.