Hot answers tagged

24 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 ...
  • 373
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 ...
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
  • 28k
13 votes
Accepted

Where should I add the API key in ORS Tools?

Open ORS Tool window. Click Settings button.
  • 3,349
10 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 ...
  • 396
10 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 ...
  • 41.1k
10 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. ...
  • 5,904
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 ...
  • 5,904
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 ...
  • 183
8 votes
Accepted

GDAL C++ API: How to create PNG or JPEG from scratch

As user30184 said, in Python, the process would be creating a memory raster of the same dimensions (layers and layer extension), and executing the CreateCopy after that: driver = gdal....
8 votes

Representing Time in GeoJSON?

The current GeoJSON specification is geojson.org/geojson-spec.html and it defines "positions" as A position is represented by an array of numbers. There must be at least two elements, and ...
  • 58.9k
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 ...
  • 2,049
8 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) ...
  • 58.5k
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 ...
  • 9,675
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 ...
  • 75.9k
7 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 ...
  • 15.9k
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 ...
  • 346
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 ...
  • 78k
5 votes

Ways to extract DEM for urban areas using Google Maps?

Alternatively, a DEM with global coverage that might suit you is the SRTM 1 second DEM. This was recently released and has a resolution of about 30 metres. Read about it at http://www2.jpl.nasa.gov/...
  • 1,343
5 votes

Ways to extract DEM for urban areas using Google Maps?

The Google Elevation API is not accurate enough at a Building level. You can test it out by using going to http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm Just search for 1 World ...
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 (...
  • 74.1k
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....
  • 15.9k
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 ...
  • 5,133
5 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 ...
  • 58.9k
4 votes

Geocoding APIs comparison

There is a free REST API at http://matchbox.io. It standardizes the address and returns lat long as well as other information. For example: http://api.matchbox.io/address/?addr_1=1390%20Market%20St%...
  • 141
4 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 ...
4 votes
Accepted

Google Earth plugin deprecated. Which alternatives?

Besides Cesium, the following alternatives could be explored for simple globe visualisations: D3js. See for example this demo, that other one, and this tutorial. Kartograph. See this example. ...
  • 10.1k
4 votes
Accepted

[GDAL API]: can't save image in some formats

I've caught my error. May be it will be helpful for somebody. CreateCopy() makes read-only Dataset for PNG and JPG, so RasterIO() doesn't write anything into dataset's bands. We have to call ...
  • 123
4 votes

NOAA API data for past monthly mean Temperature and precipitation

From the looks of it, you are getting a python error because the headers argument is expecting a dictionary, not a string The following works for me on the entire date range: import requests url = "...
  • 6,898
4 votes
Accepted

is it possible programmatically to rotate a svg of the feature without rotate all feature

In QGIS styling is layer based, so it is generally not possible to set different styles or different symbols for individual features. I think this is because features are handled by the data source, ...
  • 2,040

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