Hot answers tagged

4

From the doc: getFeatures(): Get all features on the source in random order.


4

QGIS uses GDAL to write the GeoJSON file. GDAL uses the COORDINATE_PRECISION environment variable. In QGIS that variable is hardcoded with the value of 15 (the same as the GDAL default). If you really want this, you can submit it as a new feature request at https://github.com/qgis/QGIS/issues.


3

The issue in your code is that 'fetch' is asynchronous. Therefore, when creating the GeoJSON source, the 'stations' variable doesn't have yet any value. In this case, you'd need to use Promises, async-await or a callback. From the example above: Using a callback: fetch('https://libs.cartocdn.com/carto-vl/assets/stations.geojson') .then((response)...


3

To access features in order you would need a features collection: var Source = new ol.source.Vector({ features: new ol.Collection() }); Source.addFeatures(new ol.format.GeoJSON().readFeatures(geojsonObject)); console.log(Source.getFeaturesCollection().getArray());


2

GDAL can create vector tiles with the MVT driver https://gdal.org/drivers/vector/mvt.html For converting GeoJSON data into vector tiles which are saved into MBTiles database file use a command like ogr2ogr -f MVT -dsco FORMAT=MBTILES -dsco MAXZOOM=10 target.mbtiles source.geojson Another option is to use Tippecanoe the https://github.com/mapbox/tippecanoe....


1

With the first GeoJSON you wait till data is loaded and then add it as layer. With the second GeoJSON you are missing this step so data is not available yet at the time when it's being added to the map. Order of map objects creation is also important. First create map, then layers and then add layers to the map. It should look something like this: var map ...


1

Google Maps Platform has extensive documentation on using GeoJSON data. Although it is not a Google map, you could try looking into the Leaflet package which has support for GeoJSON objects. You can then build the appropriate AJAX calls around it to get the data you need. If you just want to look at the data visually (and are not really building a web ...


1

I have a solution. You can load the geojson files using jquery. for this you have to add jquery in your program; i.e. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> And replace your code by: $.getJSON("{% url 'work' %}", function(data){ var geojson = L.geoJson(data, { onEachFeature: function(...


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