Tag Info

New answers tagged

0

Because $.getJSON() is asynchronous. So only after your request to papeleras1.php get finished you can add it to the map. You could add a listener to check when this happens. Like: map.on('layeradd', function(layer, layername){ //some action });


0

The event management for Leaflet and jQuery for this use case seems to conflict. Instead of struggling with debugging, you should better use an alternate solution like this contextMenu dedicated lib for Leaflet.


0

I found the answers to my question here: https://stat.ethz.ch/pipermail/r-sig-geo/2008-January/003052.html To further illustrate the answer, here's some sample data set. (I can't give a preview of my own, because it's confidential.) CSVdata Area Data ID Atlanta 100 1 Belgium 200 2 Canada 300 3 Denmark 400 4 Map@data ...


0

I don't see a way to convert geojson to topojson in R. The maintainers of the R geojson I/O package provide a way to read topojson, but for writing topojson they suggest using Mike Bostock's topojson tool, which requires nodejs. Install npm install -g topojson Use topojson -o output.json input.json Command line reference ...


-1

As of May 2015, mixed-type geojson files are supported.


1

You can use ol.format.GeoJSON to write out your feature as GeoJSON, and then use any AJAX / XHR library to get it back to your server. http://openlayers.org/en/v3.5.0/apidoc/ol.format.GeoJSON.html#writeFeature See also this example which uses EsriJSON but the concepts are the same: http://openlayers.org/en/v3.5.0/examples/vector-esri-edit.html


0

A bit hacky but effective L.LayerGroup.prototype.eachLayer.call(layer, each_layer_fn); I use this in a special case of a KML layer what is FeatureGroups inside FeatureGroups, to found the polygons inside I use the following function var each_layer_fn = function(layer) { if(typeof(layer._layers) === 'undefined') { // do da thing } else ...


1

Fiona doesn't support updating existing layers by design. You'll need to read your existing data in, make the changes you need, and write to a new file.


2

You could try using geoalchemy2. Personally I would look at using the Object Relational Mapper (ORM) model for working with your data, for example: from sqlalchemy import create_engine # Enter your database connection below engine = create_engine('postgresql://gis:gis@localhost/gis', echo=True) from sqlalchemy.ext.declarative import declarative_base from ...


0

For anyone else having the same problem, I've stumbled on mapstarter.com which seems to add D3 code (with mercator projection) automatically when I export to SVG. This is obviously aimed at designers and works brilliantly. I would still be interested in knowing if this is possible with CartoDB, but for now, problem solved!


0

Sorry I know my response is a little late. I faced a similar problem inserting Point coordinates to postgis but was successful when I replaced the comma in the coordinates with a space; [-48.23456,20.12345] to [-48.23456 20.12345] INSERT INTO layer_radar (id, geom) VALUES ( '3bf24920-225b-11e4-8c21-0800200c9a66', ...


0

write is just a wrapper for cat (package base). See ?write: Write Data to a File Description The data (usually a matrix) x are written to file file. If x is a two-dimensional matrix you need to transpose it to get the columns in file the same as those in the internal representation. To write a GeoJSON file, you can use writeOGR() instead ...


0

This might not be the most Pythonic solution but it works. The resulting string complies with http://geojsonlint.com/. def geojsonArea(self): coords = [] for c in self.coordinates: p = {'lat': c.lat, 'lng': c.lon} coords.append(p) geojson_obj = { "type": "FeatureCollection", "area_name" :self.name, ...


0

Remember that JavaScript runs on the client's machine, under their control. They are allowed to set breakpoints and inspect variables at run time on their own machine. You can minify and obfuscate JavaScript, but Chrome DevTools has a one-click pretty-format button to partially undo the minification enough to make breakpoints work effectively. Long story ...


0

Not sure why, changing the ajax function to re-create the source instead of adding features to the source worked: $.getJSON(global_config.services.getLayers + "?lname=fences", function (layerJSON) { if(layerJSON.features.length > 0) { var layerSource = new ol.source.GeoJSON({ style: ...


1

this API, return's GeoJson Boundaries for multiple zipcodes. you can easily add it to GoogleMaps,etc.. http://api.reaperfire.com/reaperfire/rest/v1/public/boundary?zipcode=20002,20037&format=geojson googlemap integration example: http://api.reaperfire.com/


1

Meters above mean sea level, per the RFC-001 wiki specification doc: WGS84 is implied and coordinates represent decimal degrees ordered as "longitude, latitude [,elevation]" with z expressed as metres above mean sea level per WGS84. But, unspecified, per the later RFC-2 wiki specification doc: The order of elements follows x, y, z order (or ...


2

Leaflet's map.fitBounds has an option padding which you can use like so: map.fitBounds(polygon.getBounds(), { padding:[50,50] } ); JSFiddle demo: http://jsfiddle.net/1vjqjx6h/


1

geojson styles need to be defined in javascript, not css. Here's a sample style: var countyStyle = { "color": "#cec4bc", // medium? brown "weight": 1, // stroke weight in pixels "opacity": 0.65 }; You can look up path style options here in Leaflet documentation. There are many sites to look up hex or rgb color codes and help choose ...


0

You need to use the style properties of the L.GeoJSON object. The ajax plugin is extending this object and thus, the properties valid with the L.GeoJSON object are also valid with the plugin object. << I assume your geometries are polygons/lines and not points >> // Define a style var myStyle = { "color": "#ff7800", "weight": 5, ...


4

FYI... I believe this has changed for OL3 V3.5.0, so gcarrillo's answer would be: new ol.layer.Vector({ title: 'added Layer', source: new ol.source.Vector({ url: 'mygeojson.json', format: new ol.format.GeoJSON() }) }) You can see the changes here: ...


0

This is a very broad question and difficult to answer as the solution will necessarily be complex. In some ways you are describing browser-based GIS. To get started, perhaps check out the following components: Leaflet Draw. A great set of easy to use and extendable tools for drawing and editing polygons on screen through a browser. PostGIS. Using Leaflet ...


1

GeoRSS comes in several flavours - you could use simple which is a step up from CSV. This gives you an entry like: <entry> <title>M 3.2, Mona Passage</title> <link href="http://example.org/2005/09/09/atom01"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> ...


0

I figured it out! - the problem is that my function or wherever I hold my line of code to "preventDefault()" was outside of the function that created the form in the first place. I need to place the code like such: //Custom functions upon 'edit' map.on('draw:created', function(e) { var coords = e.layer._latlng; ...


2

I faced the same issue, which seems to be related to the integration of the raster module in django 1.8's gis extension. I think I found where the problem comes from. Looking at django.contrib.gis.gdal.libgal, you can see this: ..| 47| # This loads the GDAL/OGR C library 48| lgdal = CDLL(lib_path) 49| 50| # On Windows, the GDAL binaries have some OSR ...


0

Got it; followed the advice of going all-JSON. This thing went deep! The .filter() method of javascript arrays is the key element used. Steps: 1.First finish off all the other layers, overlays defining, map initiation, etc. Start after L.control.layers(baseLayers, overlays, {collapsed: false}).addTo(map); 2.Use Papa.parse(csv) to import the CSV file as ...


2

As far as I can tell, OSM data does not define the road width, but there is a property named "highway" that describes the road type. You can use this property to symbolize different road types with different widths. For certain features, there may also be a lanes key, which you can use to get an idea of the actual road width. (But I would suspect that width ...



Top 50 recent answers are included