I am using the OpenLayers library for rendering a map in my web-page.
The map is displayed in a pop-up window.
I am querying the latitude and longitude using getLonLatFromPixel.
But, whenever I move the map window, it shows wrong coordinates.
Eg, If I move the map window to the right, it adds some value in the correct coordinates.
Related
Is there a way to move the interactive popup in mapview() to where it's offset from the associated feature? I am trying to save map images with associated information, but the attribute popup is overlaying the feature itself.
Note: I have removed personal information from the popup shown
I have added some drawing tools to my Mapbox map using the following code provided on the Mapbox website... https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
I removed anything to do with the area measurement calculation as I only wanted to be able to draw on the map.
However, the map is set to default draw without having to click the drawing icon. This means when the page opens rather than being able to pan around the map the cursor is a crosshair and begins drawing.
I noted the following section in the script but not sure what to put in place of "draw_polygon" to stop it from being the default.
// Set mapbox-gl-draw to draw by default.
// The user does not have to click the polygon control button first.
defaultMode: 'draw_polygon'
});
Anyone have any ideas how to stop draw polygon from being the default?
Also any other ideas on other/better drawing tools?
The default mode is simple_select, so you can either add this in place of draw_polygon, or just remove the defaultMode option altogether and it will start in simple_select mode.
I want to add a custom WMS layer from my GeoServer to Here map in Javascript. I found an example of adding custom-tile-overlay, but how can I get bounding box which is required in WMS GetMap request. Is there any way that I can get bounding box of the current viewport in Here maps?
The current bounding box of the map using HERE JS API 3.1 can be retrieved using the following piece of code
map.getViewModel().getLookAtData().bounds.getBoundingBox()
This would return a H.geo.Rect object containing the bounding box coordinates.
I am writing a WinForms application with a WebBrowser control. I use Google Earth Plugin in this application, and need to create some placemarks on Google Earth. Depending on the current range (zoom level) some of the placemarks may be very close to each other on screen (when the earth is zoomed out enough). In this case I want to create not all but just some of the placemarks to avoid over-crowding the map on screen with placemarks.
For example, suppose I have 1000 points I want to create placemarks. When I loop through all the points for the placemarks to be created I want to convert the lat/long of each point to the WebBrowser control's client coordinates so I can check to see if it is very close (on screen) to other placemarks already created. If it is very close to other placemarks I just skip the creation of this one. So if the user zoomed out to a certain degree the actual number of placemarks created may be much smaller than 1000 (for example, 400).
This is where I have difficulty with. I don't know if there is a way to convert lat/long to client coordinates of the WebBrowser control hosting Google Earth Plugin. I know that for mouse events the client coordinates are there for me to use but there is no mouse event involved in this case.
Anybody has an idea how this can be achieved? Thanks!
The approach you're trying to use to fix the problem is incorrect. However there a few options:
Going with your current approach -- you have two options:
You can ask the current view to convert a given lat/lon to screen X/Y.
https://developers.google.com/earth/documentation/reference/interface_g_e_view#a8c39d0324f2350c54fe2de981f1be418
You can get client mouse coordinates as part of KML mouse events that are fired off the GEWindow class:
https://developers.google.com/earth/documentation/reference/interface_g_e_window-members
The KMLMouseEvent that is fired contains client X/Y space:
https://developers.google.com/earth/documentation/reference/interface_kml_mouse_event
The correct approach would be to add KML region tags to your placemarks so that placmarks show/hide as the user pans/zooms etc.
http://www.google.com/earth/outreach/tutorials/region.html
I am hoping someone can point me in the right direction. I have a google map v3 with fusion table that I am looking to create a custom box with the content that would normally be displayed in an infowindow.
Much like http://www.instaearth.me or
http://chrismcaleenan.com/map/?page_id=7
So the user clicks on the marker and the content is loaded into a box/window/div that is not attached to the marker itself.
Does anyone know of any samples / tutorials where someone shows this being done.
Thanks
The FusionTablesLayer has a FusionTablesMouseEvent which is returned on a click (if you add a click event listener to the FusionTablesLayer). That Object contains the data in the row associated with that geographic object (icon, polyline or polygon), and you can use it to populate an HTML div on your page.
working example, zoom in past zoom level 2 to see the FusionTable code work, at zoom 0, 1 it uses the KmlLayer