Hot answers tagged

32 votes
Accepted

Passing Filter Parameters to GeoServer WFS via URL?

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 ...
user avatar
  • 51.5k
14 votes
Accepted

How do I set the fillcolor of polygons in Leaflet.js dynamically?

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 ...
user avatar
  • 1,166
10 votes
Accepted

Getting all vertex lat, long coordinates every 1 meter between two known points using PHP?

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 ...
user avatar
  • 1,188
10 votes
Accepted

Zoom to polygon bounds on click. Leaflet ´, GeoJSON

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 ...
user avatar
  • 6,823
8 votes

Convert WKT to GeoJSON with Leaflet

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 ...
user avatar
  • 6,122
6 votes

Column 'SHAPE' cannot be null in mysql database even if the query string is correct

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 ...
user avatar
  • 989
5 votes

Parse PHP/HTML to shapefile or similar

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 ...
user avatar
  • 51.5k
5 votes

Getting all vertex lat, long coordinates every 1 meter between two known points using PHP?

I did port the Python code to php: <?php function parseFloat($ptString) { if (strlen($ptString) == 0) { return false; } $pString = ...
user avatar
5 votes
Accepted

Leaflet: Map tile request, hidden key/secret via proxy

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 ...
user avatar
  • 6,122
5 votes
Accepted

Nearest Neighbor in PostGIS

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 ...
user avatar
  • 1,531
5 votes

Add coordinates after click into form

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 ...
user avatar
  • 9,285
5 votes
Accepted

Updating PostgreSQL database with PHP language

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 ...
user avatar
  • 34.3k
4 votes

Point to Line Calculations

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 ...
user avatar
  • 425
4 votes
Accepted

Column 'SHAPE' cannot be null in mysql database even if the query string is correct

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 ...
user avatar
  • 1,023
4 votes
Accepted

Geojson in postgis Geometry : Z dimension error

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);
user avatar
  • 3,217
4 votes

Postgis calculating distances between polypoints on big dataset

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 ...
user avatar
  • 6,025
4 votes

How compile/install php-mapscript on Ubuntu 16.04

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 ...
user avatar
  • 28.6k
4 votes
Accepted

How to make auto zoom when GeoJSON file is added on Leaflet map

If you keep a reference to the geojson layer you can get its bounds, and then fit the map to it. $.getJSON("{{asset("storage/upload/shapefiles/districts/atd_district_level.geojson")}}",function(data){...
user avatar
  • 3,857
3 votes

Read GeoTIFF file with php or javascript

there is a php extension called php-gdal I found some install instructions: https://www.drupal.org/node/2133103 the main site: https://github.com/geonef/php5-gdal helpful? http://dl.maptools.org/...
user avatar
3 votes

Large loads geojson from mysql to leaflet?

Here are a couple of thoughts on what you can do to boost performance: Send a BBox to server and return only points within it Use a library like turf.js http://turfjs.org/ on the client to only draw ...
user avatar
  • 561
3 votes
Accepted

What is the proper "title" property for the Terrain with Labels Basemap?

As @tmcgee points out in the linked answer, the list of basic base maps that can be passed to the constructor are set in the esriConfig defaults object. It's not that the error message needs to be ...
user avatar
  • 456
3 votes

Interpolating point set into value contours?

This article on the marching squares algorithm outlines the general algorithm. Here is a good implementation, in various languages, though sadly not Python. Having said that, the algorithm basically ...
user avatar
  • 13.2k
3 votes

Transfer Data from Database to Leaflet POP UP

The popup is printing the text just as you have written it. Use javascript variables in marker.bindPopup, not php: marker.bindPopup(data[i].name + "<br>" + data[i].user_date + "<br>" + ...
user avatar
  • 6,698
3 votes
Accepted

Put LeafletJS geoJSON's into a MySQL database through PHP

Yes. You have to send your data from the client to the server and let server-code handle the database-insert. You should look into HTTP POST through jQuery or other libraries as a way to ...
user avatar
  • 4,241
3 votes

How do I json_encode without those quotes for the coordinates in leaflet geojson polygon?

In the javascript code the array is treated as a string so try to parse this sting as json before using , then assign the result to coordinates . So if your result in success function is result , ...
user avatar
  • 31
3 votes

Load a shapefile in PostgreSQL database with PHP

First of all, You need to add a new environment variable called PGPASSWORD $ export PGPASSWORD='password' But, if you try to set as usual, the www-data doesn't see the variable, so you need to ...
user avatar
3 votes
Accepted

Take data (points) from MySQL to Leaflet Map using PHP and Ajax

See code example Leaflet users map https://github.com/bmcbride/leaflet-users-map by Bryan McBride. There is used SQLite DB, but her easy replace on MySQL.
user avatar
  • 3,473
3 votes

Sending valid UserAgent or Referer when Nominatim reverse geocode gets blocked?

by including the email parameter in my request, nominatim osm server acccepted that as a valid user agent. $url = "http://nominatim.openstreetmap.org/reverse?email=myemail@myserver.com&format=xml&...
user avatar
  • 457
3 votes
Accepted

Display Geojson data from PHP API (http://localhost/sample.php) on google map

You can use Ajax and leaflet for displaying GeoJSON data. Here is a detailed example of GeoJSON in leaflet. You have to modify 'Ajax' given below according to your php. $.ajax({ type: "POST"...
user avatar
  • 376
3 votes
Accepted

How compile/install php-mapscript on Ubuntu 16.04

Thanks to @ThomasG77 i did compile and install php5-mapscript of Mapserver7.0.2 compiled and got loaded successfully: The manual is based on mapserver general compile documentations: http://www....
user avatar
  • 262

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