Hot answers tagged

25 votes

Choosing OpenLayers or Leaflet?

Though I used Leaflet in my webGIS application, OpenLayers has much more advantages over Leaflet. For example if you want to use your application in mobile devices, OpenLayers is a must for the time ...
mkturkeri's user avatar
  • 383
14 votes

Choosing OpenLayers or Leaflet?

There is a great comparison on the two frameworks in this presentation: And another article also has a great summary: Customers often ask us, “Which is the best client-side JavaScript mapping ...
Simon East's user avatar
13 votes

Where should I add the API key in ORS Tools?

Check the 'Provider Settings' where an API Key can be given Environment: QGIS 3.18 on Windows 10
Taras's user avatar
  • 32.7k
13 votes
Accepted

Where should I add the API key in ORS Tools?

Open ORS Tool window. Click Settings button.
Noura's user avatar
  • 3,429
11 votes
Accepted

Downloading sentinel products using API?

I received help from an application developer at JNCC. I will post their answer here to help others. My problem was that I needed to escape the $ character before value. so the wget command should ...
Colabean's user avatar
  • 416
11 votes

Best-practices for databases and APIs with geographic data spanning the antimeridian

Speaking purely from a data storage and analysis perspective, the geography type for PostGIS was designed with the antimeridian in mind (among several design goals). There are several functions ...
Mike T's user avatar
  • 42k
11 votes

Is it possible to get OSM data in geojson via overpass api using ipython?

Overpass API doesn't support GeoJSON. You have to perform the conversion from JSON to GeoJSON yourself. For converting JSON into GeoJSON see this answer. It even contains a solution in Python. ...
scai's user avatar
  • 6,090
10 votes
Accepted

How to get layer variables using QGIS Python APIs?

You may use the QgsExpressionContextUtils() class. More in detail, you may set a new layer variable in this way: layer = iface.activeLayer() # or similar way for loading a layer ...
mgri's user avatar
  • 16.1k
9 votes
Accepted

How to download all OSM data within a boundingbox with Overpass?

See the Overpass API Language Guide. Basically you seem to want all data in a bounding box. Depending on your use-case you might want to download nodes, ways and relations. overpass turbo already has ...
scai's user avatar
  • 6,090
9 votes
Accepted

Getting elevation at particular coordinate (lat/lon) programmatically (but offline)?

You can use the rasterio library: import rasterio coords = ((147.363,-36.419), (147.361,-36.430)) elevation = 'srtm_66_20.tif' with rasterio.open(elevation) as src: vals = src.sample(coords) ...
user2856's user avatar
  • 65.3k
8 votes

Implementing Add Feature action using PyQGIS

I spent a while trying to figure this out too. The button is found in the QgisInterface class. # Find the layer to edit layer = qgis.utils.iface.activeLayer() layer.startEditing() # Implement the ...
Nicola's user avatar
  • 183
8 votes
Accepted

How to obtain openstreet API key for nominatim (r)?

In the comments of the source code you linked there is an explanation: @param key To access the openstreetmap API you need a valid API key. You can get it for free at https://developer.mapquest.com ...
bennos's user avatar
  • 2,069
8 votes
Accepted

Was PyQGIS released with the first QGIS version?

No, the Python API was introduced earlier. The first stable release with QGIS 1.0 in 2009. At 1.0 we provide a stable API from which you can develop custom solutions in Python or C++. See: https://...
MrXsquared's user avatar
  • 33.8k
7 votes

Downloading sentinel products using API?

A good alternative to the official Scihub is the mirrored Sentinel-2 data on Amazon Web Services. Sentinel-2 on AWS This has the advantage of better uptime and the products are already saved in ...
Kersten's user avatar
  • 9,889
7 votes

Is it possible to get OSM data in geojson via overpass api using ipython?

It is possible now to retrieve a GeoJSON object of OSM relation with Overpass convert function, here is an example: [out:json]; ( way(51.477,-0.001,51.478,0.001)[name="Blackheath Avenue"]; ...
Murz's user avatar
  • 191
7 votes

Add an API key to QGIS for QOSM layer

I guess you are using the QOSM plugin to display the OpenCycleMap, since the standard OSM map does not have API keys. You can obtain an API key from the map producer Thunderforest. They provide ...
AndreJ's user avatar
  • 76.6k
6 votes

Implementing Add Feature action using PyQGIS

A complete solution with also saving the layer, as requested in a comment: # Get the active layer layer = iface.activeLayer() # Define a function called when a feature is added to the layer def ...
Marioba's user avatar
  • 356
6 votes
Accepted

What are the differences between a WFS and a simple API?

A WFS is just an API but conveniently one where everyone has agreed a standard way of talking to it beforehand. So rather than having to read a new bunch of documentation and write some new code for ...
Ian Turton's user avatar
  • 81k
6 votes
Accepted

EPSG.io API for PROJ definitions

You are using the official site epsg.org, not epsg.io that is run by a private company. EPSG/IOPG supports only the standard formats WKT and GML. The epsg.io site supports other kind of definitions ...
user30184's user avatar
  • 64.6k
5 votes

Choosing OpenLayers or Leaflet?

It depends on what you are trying to do. Leaflet is simpler and faster for 80% of web map projects. The same way you don't need a spaceship to go around your neighborhood, most of the time I found ...
Carlos Sarille's user avatar
5 votes

Export .qml file using QGIS API

You can use QgsMapLayer::saveNamedStyle to export .qml files: layer.saveNamedStyle('/path/to/style.qml') EDIT: Yes, you can create a .qml file outside QGIS. I tested this in a standalone script (...
Joseph's user avatar
  • 75.6k
5 votes
Accepted

Improving buffer smoothness using PyQGIS?

You can use the buffer() method. It applies to a geometry object. For example, using the following code: layer = iface.activeLayer() # for example for feat in layer.getFeatures(): geom = feat....
mgri's user avatar
  • 16.1k
5 votes

bathymetry (Ocean Floor depth) data - API or similar

For Germany North Sea and Baltic Sea: Baltic sea IOW Baltic Sea Bathymetry Database Mark an area and download. North Sea AufMod sorry only german. DE: Alle morphologischen Produkte des Funktionalen ...
huckfinn's user avatar
  • 3,573
5 votes
Accepted

Download MODIS/MCD19A2 AOD product with R

This can be easily achieved using the MODIS package, version 1.1.3 or higher (previous versions didn't provide access to this product). library(MODIS) # set MODIS options (these can also be passed ...
fdetsch's user avatar
  • 5,183
4 votes

Latitude/Longitude to city and zip, batch convertion

I discovered that the complexity of installing own instance of Nominatim can be mitigated by using a docker container where the set up script is already prepared. I used a docker script available at ...
Alexey Grigorev's user avatar
4 votes

MMQGIS Geocoder Request Denied Error - Using Google API Key

Figured it out and posting for those who encounter the same issue. I got the full error from Google: REQUEST_DENIED Requests to this API must be over SSL. Load the API with "https://" instead of "...
J. Strahan's user avatar
4 votes
Accepted

OSM table(Matrix) Api returning distance 0 for small routes

You need to swap the coordinates, Lat in place of long and long in place of lat as below: http://router.project-osrm.org/table/v1/drive/72.5024,22.9755;72.5647,23.0143;72.4796,23.0483?sources=0
Shiko's user avatar
  • 2,883
4 votes
Accepted

Read CSV from API with ogr2ogr

Addition due to comments Using /vsicurl_streaming/ and CSV: before works. You can try using the following command: ogr2ogr -f "ESRI Shapefile" fake.shp CSV:"/vsicurl_streaming/http://api.statbank.dk/...
ThomasG77's user avatar
  • 30.5k
4 votes
Accepted

Does Esri Geodatabase contain style information?

If you want to transfer styling info for your file geodatabase then that can be done using: Layer file (without data) Layer package (includes data) Map document (without data) Map package (includes ...
PolyGeo's user avatar
  • 65.1k
4 votes
Accepted

How to get OSM API key in QGIS?

You need a key for the Thunderforest maps, they provide own servers and map styles based on the OSM data (which itself is free to use without any key restriction). You will need to sign up an account ...
geozelot's user avatar
  • 29.9k

Only top scored, non community-wiki answers of a minimum length are eligible