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


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

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

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 would need to georeference (that's the term) image with QGIS. See my answer to this question for tutorial links.


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

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


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

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

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 asynchronously send your data from the client to the server.


1

I think the application server will be doing very little so I would just go with whatever web framework you are already familiar with. You can configure GeoServer completely using their REST API and you can manipulate/query the data directly from GeoServer using WMS/WFS (preferably with JSONP) without having to touch PostGIS directly. All the application ...


1

How can I pass the value from the HTML/JavaScript to the PHP file where I have the connection with database? If you use jQuery, you can use an AJAX call like this: $.ajax({ data: {lat : lat, lng: lng}, type: "POST", url: "script.php", success: function (e) { alert(e); }, error: function (er) { ...


1

What are looking for is an OpenLayers strategy. You do not use this directly, but one of the subclasses, such as BBOX or Cluster or Fixed. The cluster strategy does as it says and combines point that are close together into clusters, based on a threshold, which will lead to much faster rendering times when you have many points in view. Unfortunately, the ...


1

You shouldn't need to re-implement the wheel, there are lots of geospatial libraries out there. As you've noticed, PostGIS includes a buffer function, unfortunately MySQL has sub-standard spatial support and therefore doesn't include one. If possible you may wish to consider switching to PostGIS if spatial functionality is important to you. There are ...


1

Glad you got it sorted out. It is worth clarifying that the basemaps from the BasemapGallery have no relationship to the basemap ids of the map object. The mechanics as I understand them are as follows: The widget retrieves the basemaps it uses from ArcGIS Online from a specific map group. First it searches for the group based on title/owner: ...


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

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

Ran, Where is your PostgreSQL database housed. On BlueHost or somewhere else. You might want to check out last chapter of 2nd edition of our book which covers these topics and provides examples in PHP -- you can download the code for free has examples of Leaflet and OpenLayers with PHP http://www.postgis.us/chapter_17_edition_2 (2nd edition currently in ...


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.


1

Found the solution. Taking Poland as example: First I had to find vovoidenships. Some of vovoidenships were saved as closed polygons in planet_osm_polygon, some as set of records (lines) in planet_osm_line. In case of polygon, thing was pretty simple, it was all about proper query: INSERT INTO out.city (region_id, city_name, coordinates, ...


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



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