Hot answers tagged

30

I suppose you have been reading this http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html Here comes some sample requests which are sending queries for the demo server of Boundless but which should work similarly with your own server if you have demo layer topp:states installed. Select where STATE_NAME is Illinois http://demo.opengeo....


14

You can change the fill color of a polygon with the setStyle method (inherited from Path). polygon.setStyle({fillColor: '#0000FF'}); If you're having difficulty getting the geojson displayed properly you might take a look at the Leaflet GeoJSON docs.


10

This is quick and dirty. Most of this was adapted from the following website: http://www.movable-type.co.uk/scripts/latlong.html I haven't tested this too much but it seemed to work after initial testing. It will return a list of lat, long coordinate pairs along a line at a specified interval. I wrote it in python since I don't know php very well. from ...


10

Probably: markers.on("click", function (event) { // Assuming the clicked feature is a shape, not a point marker. map.fitBounds(event.layer.getBounds()); }); You may want to detect if the clicked feature is a marker (point feature), and act accordingly, as it will not have the getBounds() method. References: Event object event.layer Note: in the ...


8

If you've already got WKT, then you might considering using the JavaScript library, Wicket, to go straight from your WKT to Leaflet features. As this example shows, you can pass in a WKT string and a style/options object, and Wicket will return a feature object you can attach directly to a Leaflet FeatureGroup, etc. This example assumes two things: 1) You ...


7

Your generated GeoJSON is valid JSON, no problem. But, it's not valid GeoJson, as you can see here: http://geojsonlint.com/ The problem seems to be that the features-array in your featurecollection contains three features, two with geometry:none and one with just geometry (which is also string-encoded). So, in short: Your OpenLayers-code seems fine, the ...


7

Since your search region is circular, it is perhaps best not to consider it to be a polygon, but as a point with a radius and to use the ST_DWithin() function: ST_DWithin — Returns true if the geometries are within the specified distance of one another. It should save you and the processor a lot of effort.


6

This depends on what you want & need. You may only need "dead" bitmaps, or you may need "alive" objects in your client. There are numerous solutions out there, depending on your needs. You need a client in your browser, OpenLayers is perhaps the most prefered open source solution. As for the service backends, e.g WMS and WFS, Geoserver and Mapserver ...


6

It seems you try to persist your entity and its id remains null. That's why your get a constraint violation error. To simply solve this error I suggest you to try create your database table using auto-incrementation option on your SHAPE field. It should solve your problem, I guess. OR Reading the documentation on LAST_INSERT_ID() I would suggest that the ...


5

A quick solution to serve up shapefiles on a basemap in a webapp is through a free arcgis.com account. They allow you upload .shp files, symbolize, and lay them on a base map. The share tool allows provides a html script that can be copied. I served up some symbolized counties to my blogger page in a webmap. Note that ESRI is trying to monetize arcgis.com ...


5

You could use TileMill to make tiles as MBTiles: https://www.mapbox.com/tilemill/ Then use something like python-mbtiles to serve it up: https://github.com/perrygeo/python-mbtiles.


5

This only a partial answer and lacks all python but too long to fit into a comment field. Your data is rather easy to convert into WKT: capture the coordinate part switch commas to spaces and spaces to commas close inside WKT polygon: POLYGON ((...)) POLYGON ((39.655756 -4.034769,39.655757 -4.034769,39.655758 -4.034769,39.655800 -4.034788,39.655885 -4....


5

I did port the Python code to php: <?php function parseFloat($ptString) { if (strlen($ptString) == 0) { return false; } $pString = str_replace(" ", "", $ptString); if (substr_count($pString, ",") > 1) $pString = str_replace(",", "", $pString); if ...


5

It seems to me you have three main options: Use ST_DWithin to identify a vertex within a certain distance of the coordinates. The advantage to this is that it makes use of spatial indexes on the geometry column and will be much faster. The disadvantage is that it may not return the nearest road vertex if there isn't a nearby road, or may return multiple ...


5

Create your <input> with an unique id, so then later you can get a reference to it via document.getElementById(): <input type="text" id="coordy" /> There is no need to include a value attribute in this <input>, as the value will be overwritten later. See the documentation for the <input> HTML tag about its value attribute. Note that ...


5

The line $sql='UPDATE signaletique SET infos="'.$_POST['maj_infos'].'"WHERE id="'.$_GET['feature-id'].'"'; is extremely bad. Seriously. Let's start with the gentle item: in Postgres, double quotes are used to specify an object name, in this case a field. The content of maj_infos is therefore interpreted as a field name, which likely does not exist. Then ...


4

The answer to your question is subjective (a matter of opinion) so it might be voted down (-1). Since your new to this site, I will go ahead and answer -- mapserver, open layers and postgis sql would be a very good combination for an open source solution. Geoserver is also an option instead of mapserver -- it is java based. There are also other javascript ...


4

For current method ST_AsText() I suggest that you request GeoJSON instead this can be requested from PostGIS natively Example: SELECT ST_AsGeoJSON(the_geom) from fe_edges limit 1; st_asgeojson ----------------------------------------------------------------------------------------------------------- {"type":"MultiLineString","...


4

If you want to make browser download the generated KML, an extra header is needed: header("Content-Disposition: attachment; filename=MY_KML_FILENAME.kml"); Otherwise, just ignore the message, it's harmless. Chrome doesn't recognize the KML-specific Content-Type, and expects ordinary text/xml or application/xml, but since it's all XML, it should be parsed ...


4

I would recommend to rely on GeographicLib implemented by Charles Karney which uses Gnomonic projection for point to line projections in WGS-84 (http://geographiclib.sourceforge.net/). This solution is discussed and proven to be highly accurate in Charles Karney, Algorithms for geodesics (http://link.springer.com/article/10.1007%2Fs00190-012-0578-z). A ...


4

In line $polywrite = "<script>document.write(polygon)</script>" you are trying to use javascript code while it is imposible in php side. All php scripts run before javascript. You can use proj4php as mentioned in the comments. Another solution is to fill the polywrite variable at javascript side and create an Ajax request sending `polywrite' to a ...


4

You were almost there... MultiPolygonZ should do the trick: ALTER TABLE urbana_prueba ALTER COLUMN geom TYPE geometry(MultiPolygonZ, 3857) USING ST_Force_3D(geom);


4

Basically you just need a PHP script that acts as a middle man and does the fetching for you, then returns what it gets directly to the client. I converted your JS snippet above into the relevant parts below. Notice that the url in your Leaflet tileLayer example has been changed to a PHP endpoint with URL parameters: ?s={s}&z={z}&x={x}&y={y} ...


4

This should be possible with the window functions of postgres. With lag and lead you can define which rows are being compared with the second parameter (here set to 1 as example) you can also compare rows that are further away. ST_Distance(geom, lag(geom,1) OVER (ORDER BY gpstimestamp)) Did test it with a dataset of 28k polygons and it was finished in ~ 1 ...


4

First answer Don't try to compile Mapscript on Ubuntu 16.04 with PHP as long as your PHP version is not 5.x. It will not work for the simple reason that supported PHP version in Ubuntu 16.04 is 7.0 and infortunately for you PHP 7 and MapScript are incompatible at the moment. You can see the related opened issue on the official MapServer Github repository. ...


3

I'm sure if there is a more elegant way to do this , but you can use a php script to query the database, and modify the result of the query to your need (eg query the coordinate of a given parcel, and use those to change zoom and center with with yourMap.setCenter. My php script looks something like <?php // Connecting, selecting database $dbconn = ...


3

I think GeoMajas is a good choice. For routing purposes I want to introduce you Graphhopper. It's still a young project, but it's java, it's incredibly fast and there are ready to use applications to route either on a web server or on the mobile device itself based on openstreetmap data. So if you have no problems to use openstreetmap and want to route on a ...


3

There are a lot of options. OpenLayers or Leaflet are probably a good place to start for the client side and they can read local shapefiles. For more options have a look at the OsGeo website (especially note the webmapping links on the right hand side).


3

1) If you want to create a shapefile for download, you should be able to publish an async geoprocess that will return a link to the location of the generated shapefile on your ArcGIS Server. You call this service from the javascript API using esri.tasks.Geoprocessor. Take a look at the clip-and-ship example. It uses a file gdb, but you should be able to ...


3

You can convert the shapefiles to geojson or gml or kml. After that you can use and tweak the examples in OpenLayers or Leaflet to display your data.


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