Hot answers tagged

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 ...


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

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 ...


3

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.


2

Yes, you can do it. Just render the HTML you need in the view and "inject" that code in the visualization infowindow template. For example: ... layer.infowindow.set('template', document.getElementById('infowindow_template')); ...


2

Yes you can get them to work together. Below is a sample of code from a php page I coded that uses proj4js, mine is slightly different going from a state plane into wgs84 but the concept is the same. (The syntax is a little off as I had problems pasting it into a code block and my code is sort of spread all over the place in a couple php files but I think ...


2

I depends on how you create or add the table to the database. If you upload your table to the database through any tools like shp2pgsql or QGIS a geometry column is made for your to store the spatial data in. You will need to manually create the geometry when inserting to the database. INSERT INTO mytable(mycol1, mycol2, geom) VALUES(1, 2, ...


2

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 ...


2

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);


1

This can be relatively simple for very small scale systems (e.g., one route and bus), but gets more complex as more buses and routes are introduced. First, you need an app on a device to send vehicle position data - from this post on the onebusaway-developers group: https://groups.google.com/forum/#!topic/onebusaway-developers/JzYMwLFCpT0 See this post ...


1

The problem was related with the security authentication of PostgreSQL. After adjusting this in the configuration of the database I was able to login automatically using this: shp2pgsql -s 2100 -d /var/www/dkar/MarCO/Code/python/output/cluster/clusterNodes_.shp | psql -U username -d databaseName Hope this helps someone.


1

Yes this can be done using http://proj4js.org/ you can find your parameters here http://spatialreference.org/ the rest is just code. I have a similar php script in a web page that converts from State Plane Coordinates into Lat/Long EPSG 4326. It basically follows this logic, ignore the extraneous stuff, that i think can be applied to your problem. ...


1

I've solved putting $db->loadExtension('mod_spatialite.so'); in my PHP code and configuring the LD_LIBRARY_PATH env variable in thsis way export "LD_LIBRARY_PATH=/usr/local/lib"


1

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&lat=-23.56320001&lon=-46.66140002&zoom=27&addressdetails=1"; Nominatim WIKI parameters


1

In addition to Wicket, there is also Wellknown // With Leaflet or MapBox.js var geojsonLayer = L.geoJson(parse('Point(1 2)'));


1

Your code: Wont work because 'Incidents' isn't defined yet (hence your error message). Try running it without the 'Incidents' in here. Or drop your code into this section: function showIncidents(ajxresponse) { lyr.clearLayers(); lyr.addData(ajxresponse); } Something like this: function showIncidents(ajxresponse) { // Incidents geojson layer ...


1

Over at GeoNet, Junshan Liu pointed out the following. This is caused by getPath function in env.js. In this function there is path check /\.html$/.test I found that on line 162 in env.js and changed it to ... } else if (/\.php$/.test(fullPath.split('/').pop()) || /\.html$/.test(fullPath.split('/').pop())) { And that now allows me to load either ...


1

As mentioned by TsvGis, you'll probably need to embed the font in the document. You appear to be using reportlab for this, check the FAQ on their site, they have an example of how to embed fonts - section 2.6.2 Be aware that there might be licensing issues on some commercial fonts (they may not embed properly). If this is the case there are plenty of ...


1

I don't know if this is a Drupal thing or not, BUT I can tell you why under PHP exec would not be allowed. Many shared hosts run PHP in safe mode. This is done primarily to prevent one account using the OS facilities available on the running server, being used to gather information from other accounts on the same server. Anything that can be used to run ...


1

If you have access to the Geocortex Site, then the easy way to consume your data is by using a Workflow to make the web request from the Geocortex Essentials server, which can then create a new Graphics Layer and add it to their map. If you don't, then making a WMS server is one option. However, it would be simpler to generate a GeoRSS feed of your points ...


1

You have to convert the received unreadable data to hexadecimal string. You will get this 24 41 20 20 67 72 51 30 35 41 68 40 2018 29 fffd fffd fffd ff ff fb ff ff fffd fffd fffd fffd b0 23 7e c0 201a a1 55 Then you can split it and parse it like this. First 2 digital(24), stand for standard mode next 10 digital, is device'ID (41 20 20 67 72) 6 digital, ...


1

While your PHP looks to be creating an array, I'm not sure that you're going to have consistent luck getting JS to read it that way (an arrant space here or there, etc.). At least I've tried that in the past, only to realize that while it LOOKS like a good array, it isn't. I think you're better off just returning your MySQL as a true array and then using ...


1

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 add the line PGPASSWORD='password' to the /etc/apache2/envvar. Test if this works typing: sudo -u www-data bash -c "<the_command_shp2pgsql>" Then ...


1

You could issue a AJAX request to your PHP service. In Javascript, add an event listener to your radio buttons that listens for change events. In the listener, issue the AJAX request to your PHP service. Handle the response of the PHP server in the AJAX callback and update your map.


1

If you get results from your php code, copy that json result into the tester on geojson.io or geojsonlint.com to check the format, once you confirm the data, take a close look to the "coordinates" values, sometimes PostGIS brings that data in a format that leaflet cant draw. If coordinates are alright, then someting in the code html code is the problem. One ...


1

You get this error when there are no results, so the query returns 0 records, and row[0] does not exist. Using another postgres query method you can avoid this error: $result = pg_exec($dbconn, $query); $numrows = pg_numrows($result); // Loop through rows in the result set for($i = 0; $i < $numrows; $i++) { $row = pg_fetch_array($result, $i); ...



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