When I pan the map with the mouse, I want the visible layers to update (before I release the mouse). Ideally, it would actually be preloaded, like the basemaps, so that you don't have to see the unloaded edge of the layers.
Example: Say I have a layer which is a solid red block over the entire map. When I pan, the screen moves so that you see that the red layer doesn't extend to infinity; it's actually covering only the viewport. It now appears as a rectangle which is moving around the screen as you pan, until you release. I want the user to be able to pan and only ever see red. This is a contrived example, but it's the functionality I want.
What doesn't work: I have already tried running a layer.refresh() command on the map's pan event. That won't work until after you release the mouse.
Well, As I am understanding above requirement. you want to add a layer on the ESRI map; which will refresh every time you pan or zoom.
In this case no need to add the layer as ArcGISDynamicMapServiceLayer. Simply add the layer as a feature layer in ondemand mode.
To know about feature layer and its mode please click here...
As we know it request to update layer automatically whenever you change extent of the map.
Hoping I gave you the hint which you are looking for... :)
Related
The question posted below
how to rotate a google map in a web application
can be use to rotate the map by rotating the div which contains the map
but if i do scroll or drag on the map the map is working in unpredictably way is there a way to retain those functionalities as it is
Note: i am rotating the map using div because the aerial tiles are not available at that location.
Please say whether this can be done with some other map api are how to go about it in google map API
It is difficult to answer with certainty unless you post a more complete answer, but I believe your issue is with the corrodinate system.
You are rotating the display of the map, but the x,y coordinates of your mouse are not. When you drag the mouse, the javascript is capturing the mouse movement relative to the screen and then you are rotating the output by 45 degrees. In other words, google maps has no idea that you have rotated it. It would be the same output if you just turned your monitor 90degrees, the mouse is still going to send the same x,y coordinates.
In order to do what I think you want you would need to take over the code handling the movement or accomplish it another way. You will notice that the dragging is disabled on the example you referenced.
This might be a place to start looking for getting the center of the map on mouse events:
https://developers.google.com/maps/documentation/javascript/3.exp/reference#MouseEvent
You might be able to get the current coordinates and "transform" the new coordiantes by looking at this example of getting pixels:
https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
Here is a page explaining some things about transforming coordinate systems:
http://www.continuummechanics.org/cm/coordxforms.html
If this is something that you really have to do, it can probably be done, but it is likely a lot more trouble to get right than it is worth for an average map embed. It might also add a lot of processing that will make the interaction pretty laggy.
After saying all that, I'd still love to see an example of this working so if you do make it work please post some code.
I have one problem (first entered as a comment, Aug 2014). The first time I drag pegman onto the map (having moved it using GeoCode away from the default centre), it shows streetview at the default centre (GMMap.RequiredProp.Center.Lat/Lng). Doing it a second time works fine. When I drag pegman, I can very quickly see the correct streetview, then this is overlaid with the wrong one.
My guess is that the streetview layer exists when the program starts, but is not visible. Dragging pegman makes it visible, which then provides the opportunity to close the layer. Dragging pegman a second time creates the layer at the correct position, then makes it visible.
I notice that MegaDemo does the same thing, showing Gaudi's cathedral when the pegman is first dragged onto the map somewhere else.
How do I show the correct position first time?
Regards,
Dan
i had the same problem and i probably found solution. It is in DoMap script in map.html which is contained in gmmapres.res.
Sinner is line
panorama.setPosition(new google.maps.LatLng(Lat,Lng));
when i commented it and recompiled resource (rc.cmd) and then GMLib, Streetview started to work correctly.
I am doing some research for what Map API to use for a coming project.
The main requirement is the ability to lock a map, and the ability to disable parts of the map.
Think about a special purpose map for Europe where I would like to disable and gray out the non-european countries.
A click on those grayed out areas should do nothing, meaning for all of the world except for Europe.
So, is it possible to disable large portions of the map?
Is it possible to add layers for the borders for each country, that is clickable, for instance on Germany?
I am looking at Bing or Google Maps at this point. Which one is more developer friendly one?
Bing looks so much nicer with the birds eye, much easier to read out the map and know what you are looking at. I find Googles full of clutter and always have problem knowing what I am looking at.
Possible approach(google-Maps): use a Polygon with multiple paths.
1 path for the entire world(vertices defined in clockwise order)
other paths for the enabled area(vertices defined in opposite clockwise order)
The result will be a polygon that covers the entire world with a hole for the enabled area. The map will not respond to click-events outside the enabled area(because it's covered by the polygon). The map will still respond to dblclick and zoom in, but this may be avoided by cancelling the propagation of the dblclick-event of the polygon.
It wouldn't be possible to gray out the dissabled area, but you could use the fillColor of the polygon to signalize which part of the map is disabled.
I am building a site with some features of google map. I want to pan, zoom in out a map with tweening effect. But when I zoom the map(Movie clip) it zooms out of the rectangular boundary.
I also want to wrap the map(when scrolled).
How can I do all these?
Check out the panning/zooming example from the Flex Interface guide:
http://www.adobe.com/devnet/flex/samples/fig_panzoom/
It demonstrates how to do what you're looking for (though not the map wrapping).
To wrap, you will need multiple copies of your map image.
I have a web application that needs to display 30,000 markers on a map at the same time. I don't want to use any kind of clustering. I need them to all be displayed.
I also need them to be clickable. The user can click on each point and a popup will come up with information about that point. Even at a low zoom level when there are thousands of markers in a single 256x256 square, the user needs to be able to click on them. It may be cumbersome for the user to click on a point thats bunched up with hundreds of other points, but if there happens to be one marker in the middle of nowhere, I want the user to be able to click on it right there instead of having to zoom in.
How do I do this? I know it's possible because I watched a video on google video where this guy creates a GTileLayerOverlay app that had clickable markers. He didn't explain how it was done though.
Is my only option to just remove the GTileLayerOverlay at high zoom levels and replace it with a true GMarker layer? I really don't want to do that. It seems over engineering to me.
If you were me, how would you go about this?
I found this example is in the Google Maps API Demo Gallery:
Clickable Tile Layer
This example creates a custom map type (GMapType) that shows regional borders and squares for county centers. When the squares are clicked, an info window opens with information about that county. The clickability is accomplished by passing in information about clickable pixel bounds in the cookies attached to the tiles, and doing a client-side check on mouseover for whether the mouse position was within the pixel bounds.
Here's some commentary on his method.
I don't have any experience with GTileLayOverlays, but I believe it is possible to accomplish what you're trying to do without using GMarkers.
Would it be possible to utilize clustering if each cluster could bring up a list of the markers it represents? It seems like having 30,000 markers visible at once would be visually confusing and difficult to navigate .