openstreetmap

Viewing maps with PyQt4 QWebView using python 3

烈酒焚心 提交于 2019-12-01 05:40:29
问题 I am building a program that can show a map with a markers according to specific coordinates from a database, so the process is: Get the map from osm using (folium) Add the marker Save the map as HTML Show the map.html in QWebView. But this way is not practical if the coordinates are always changing e.g(vehicles tracking system). Is there anyway that could allow me to add or update markers on the map avoiding the previous process, without having to create the map.html file then load it to

How to remove marker from leaflet map

故事扮演 提交于 2019-12-01 03:34:07
I am adding marker on map on user click. Problem is that I want only one marker but now whenever I click on map new marker is added. I am trying to remove it but nothing happens: var marker; map.on('click', function (e) { map.removeLayer(marker) marker = new L.Marker(e.latlng, { draggable: true }); marker.bindPopup("<strong>" + e.latlng + "</strong>").addTo(map); marker.on('dragend', markerDrag); }); Instead of using .on to capture and handle the event, you could use .once . That way the event will be only captured once and the handler will unbind itself after that. map.on('click', function ()

OSM Data parsing to get the nodes with child

蹲街弑〆低调 提交于 2019-11-30 23:56:16
I download Open Street Map data for a small region, I want to filter the data to get the nodes with special category. Here is sample of the OSM data <node id="505126369" lat="31.2933856" lon="34.2687443" user="JumpStart International" uid="125156" visible="true" version="1" changeset="2568758" timestamp="2009-09-22T13:05:10Z"/> <node id="505126372" lat="31.2682934" lon="34.2745680" user="JumpStart International" uid="125156" visible="true" version="1" changeset="2568758" timestamp="2009-09-22T13:05:10Z"/> <node id="505126375" lat="31.2953082" lon="34.3471630" user="JumpStart International" uid

how to get points return from OpenLayers.Control.DrawFeature

纵饮孤独 提交于 2019-11-30 22:07:03
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" debug="true"> <head> <title>Mapping project</title> <link rel="stylesheet" href="default/style.css" type="text/css"> <link rel="stylesheet" href="example/style.css" type="text/css"> <script src="js/jquery-1.8.2.js"></script> <script src="OpenLayers/OpenLayers.js"></script> <script type="text/javascript"> var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984 var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection var extent = new OpenLayers.Bounds(85

OSMNx : get coordinates of nodes using OSM id

时光总嘲笑我的痴心妄想 提交于 2019-11-30 20:25:29
I used the Python library OSMNx to draw an optimal route between several steps of a city trip. The final variable is a list of OSM ids . Now, I'm trying to save this route as a shp or json files. The problem is that I need for that the latitude/longitude of each node, but I didn't found an OSMNx function to do that. I tried get_route_edge_attributes (but coordinates are not a valid attribute for this function). There is any way to get coordinates of an OSM node with this single id ? Thanks in advance. you have all the attribute of each node and edge in the Graph. you can get node attributes

Show only United States when using Leaflet.js and OSM

﹥>﹥吖頭↗ 提交于 2019-11-30 20:06:35
I'm using leaflet.js and OSM tiles to create a map, but I'd only like the continental United States to be viewable, not the entire world. Is that possible? I'm loading the map like this: var map = L.map('map').setView([39.82, -98.58], 5); L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', { attribution: '...', maxZoom: 18 }).addTo(map); That's possible and easy to do. First of you'll need the coordinates for the bounding box (the outermost edges) of the continental united states. You can just google them, i found them here: http://isithackday.com/geoplanet-explorer/index

Parsing a large .bz2 file (40 GB) with lxml iterparse in python. Error that does not appear with uncompressed file

时光怂恿深爱的人放手 提交于 2019-11-30 19:51:05
I am trying to parse OpenStreetMap's planet.osm, compressed in bz2 format. Because it is already 41G, I don't want to decompress the file completely. So I figured out how to parse portions of the planet.osm file using bz2 and lxml, using the following code from lxml import etree as et from bz2 import BZ2File path = "where/my/fileis.osm.bz2" with BZ2File(path) as xml_file: parser = et.iterparse(xml_file, events=('end',)) for events, elem in parser: if elem.tag == "tag": continue if elem.tag == "node": (do something) ## Do some cleaning # Get rid of that element elem.clear() # Also eliminate now

How to use OpenStreetMap/OpenLayers?

白昼怎懂夜的黑 提交于 2019-11-30 17:59:10
问题 I am searching for an example how to use OpenStreetMap with PhoneGap and Android. I found only old examples at the web, f.e. http://mab.edina.ac.uk/geomobile-test/osm.html, but it didn't work with the newest PhoneGap, I followed the tutorial at PhoneGap. Manifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.h3llghost.phonegap.test" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion

How to integrate OpenStreetMap into a react-native project?

天大地大妈咪最大 提交于 2019-11-30 17:09:44
I'am trying to integrate OpenStreetMap into a react-native project.But i can't find any library or anything related to react-native in their github account(link given below). https://github.com/openstreetmap The only thing i can find relating to these to topics is the below link in which there is no proper answer. https://www.reddit.com/r/reactnative/comments/5fi6bg/how_to_add_openstreetmap_to_a_react_native_project/ But one guy have said that mapbox uses openstreet map as their source.The mapbox suggests a good way to integrate it into a react-native project(link given below). https://github

Plotting points from a data.frame using OpenStreetMap

南笙酒味 提交于 2019-11-30 12:18:33
问题 I am a complete novice with spacial data. I have the following code that successfully plots a bounded map. I would like to add, as points the data.frame stores. I apologize in advance for not being able to figure this out from the OpenStreetMap documentation...code below: library(OpenStreetMap) stores <- data.frame(name=c("Commercial","Union","Bedford"), longitude=c(-70.25042295455933,-70.26050806045532,-70.27726650238037), latitude=c(43.657471302616806,43.65663299041943,43.66091757424481))