Tag Info

Hot answers tagged

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


5

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


4

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.


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


2

The error was actually happening where the sql command was generated at this line of code: $sql = "SELECT " . pg_escape_string($fields) . ", st_asgeojson(transform(" . pg_escape_string($geomfield) . ",$srid)) AS geojson FROM " . pg_escape_string($geotable); Turns out that there is a bug in the code presented here, and the correct name of the transform ...


2

The first thing to do is to display the returned error as follow. You should then be able to find the error : # Try query or error $rs = pg_query($conn, $sql); if (!$rs) { echo "An SQL error occured.\n"; echo pg_last_error($conn); exit; }


2

Try here: Integrate GeoJSON file with openlayers.protocol.http See my answer (the accepted one). The code will solve your problem for sure. After all, try to access your URL (gj/DB2GeoJson.php) using the browser and check it here : http://json.parser.online.fr/ Check for blank spaces and strange characters (PHP is the winner in messing html things). Don't ...


2

You would need to georeference (that's the term) image with QGIS. See my answer to this question for tutorial links.


2

I found the correct answer here ... it's tested many times and works like a charm http://tutorialspots.com/php-detect-point-in-polygon-506.html


2

Although your question probably is harder than it seems due to curvature (spheical trig) issues, if you're happy to ignore that, there are a few ways to do a point-in-polygon check. I've used a ray casting algorithm, and you should be able to find example code somewhere to do that. If you're using Python, just use Shapely. If Javascript, here's some code.


2

a simple algorithm would consist in checking that you are on the "good" side of the lines that build your polygon. For instance, the long of your point has to be larger than the long of the West side and smaller than the long of your East side at the lat of your point. e.g. Long_point > Long_LowerLeft + Lat_point * ( Long_UpperLeft - Long_LowerLeft)/ ...


2

You may try this project instead: https://github.com/klokantech/tileserver-php/ It is easier to install, tested on several free web hosting providers, it can run also without .htaccess (if really required) and there are sample viewers (Leaflet, OpenLayers, OL3, Google Maps API, etc) presenting a copy&paste ready JavaScript source code for how to use ...


2

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


2

If you're looking for geojson support, I would go for builtin PostgreSQL capabilities instead of parsing it with PHP. It's available since version 9.3 and it works like charm with Leaflet library. You'd also probably need to do some routing if you want to build a RESTful app and you might find any of these PHP framework handy.


2

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 updated, it's that the constructor can only be passed a value in this list and that doesn't include an entry for the Terrain with Labels basemap. I've handled ...


2

PHP knows nothing about the SQL query sent to PostGIS. Therefore, it doesn't matter if you have nested queries or not. But it is very important for PostGIS, in order to perform the query, to receive a valid query, like you did when you have used PgAdmin. So, I think you need to revise your php $sql variable, like this: $sql = "SELECT name, ...


2

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 just operates on arrays in loops, so ought to be reasonably easy to port. I have used the Java version to do contours and can confirm that it works, in the ...


2

I think the best approach is to go with Mapserver or Geosever (since you are new, Geoserver will look a lot easier) Once you set a WMS service with geoserver, you can add the resulting WMS to your OpenLayers project. Geoserver automatically returns only the information in the extent of the current view, also you can set the range of visible scales on your ...


1

If you plan to use Mapserver and PostGIS, you may edit the spatial database using WFS-T provided by TinyOWS add-on: link to the docs There is also a project called dirt-simple-postgis-http-api (former PostGIS RESTful Web Service Framework), but it's read-only. For full CRUD capabilities, you will have to create a backend service from scratch. ...


1

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/dl/php_ogr/php_ogr_documentation.html I looked at scruss' suggestion: ( How to read GeoTIFF using PHP? ) and downloaded the code to take a look at. I'm not ...


1

GDAL using a .vrt file could also be a solution. You vrt would look like: <OGRVRTDataSource> <OGRVRTLayer name="feature_name"> <SrcDataSource>your_csv.csv</SrcDataSource> <GeometryType>wkbPoint</GeometryType> <LayerSRS>EPSG:27700</LayerSRS> <GeometryField encoding="PointFromColumns" ...


1

OpenStreetMap uses boundary relations for defining borders for areas/territories/jurisdictions and similar administrative things. So you have to look for relations tagged with boundary=administrative and certain admin_level=* values.


1

You may possibly want to look into querying against Nominatim. https://github.com/kenguest/Services_Openstreetmap - a php based library for interacting with both the main OSM api and Nominatim api also might be of interest to you; specifically the getPlace method. (disclaimer/disclosure: I'm the author.) As a very quick proof of concept, you could model ...


1

It depends on how many files you need to convert. If you have a lot, a simple solution is to install the free GeoServer and publish all the shapefiles as WMS or WFS (depending on use-case). Geoserver handles the delivery and you do not need to no any conversion. This will allow you to overlay them in most web map scenarios without overloading your client ...


1

Ok, this is not really a GIS related but rather a programming related question. Anyway, for your intended purpose you can use almost any language you like. Here is a very, very simple PHP script based on the example Mapfile from the documentation at http://www.mapserver.org/mapscript/php/by_example.html. In this script only the variable DATA is altered: ...


1

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


1

This sort of thing is what humans are good at but computers aren't good at. One approach that may help is sorting the points in clockwise order, this will give you mostly what you want but will still need some manual intervention with a software package like ArcGis or QGIS. In essence find the leftest point (lowest X), if two are colinear then the one with ...


1

It will give you just the names and a point near the center of the region (someone correct me on the location of the point if I'm wrong please), but what about GeoNames from the NGA? Note, however, that their coverage does not include the U.S. For that, you would want the Geographic Name Information System (GNIS) from the USGS. Link for GeoNames is: ...


1

Theres a "kind of" API (read: some features are available through HTTP requests) described at http://geonetwork-opensource.org/manuals/trunk/eng/developer/xml_services/index.html . From that document: Url: http://localhost:8080/geonetwork/srv/eng/xml.search Mime-type: application/xml Post request:s <?xml version="1.0" encoding="UTF-8"?> ...


1

This is a two step process: Using ArcGIS for Desktop export a single Layer to KML or a whole Map to KML Display your KML in Google Maps - perhaps using Google Maps JavaScript API v3.



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