Tag Info

Hot answers tagged

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

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


4

This depends on what you want & need. Do you only need "dead" bitmaps, or do you 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 ...


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


3

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.


3

How do spatial algorithms help? There are many ways spatially based algorithms can improve upon traditional algorithms. Often, you can use spatial algorithms to drastically lower the amount of records you have to loop through, such as when using distance in your calculation. Give me an example! Let's use this question that was asked today as an example. ...


3

I'm assuming that your 'rectangle' is in 2D, and not wrapped around the earth. Suppose you have the Center at x and y. And your Height & Width are h & w. In that case, simple arithmetic will give you: min_x=x-(w/2) min_y=y-(h/2) max_x=x+(w/2) max_y=y+(h/2) These four values will give you the four coordinates.


3

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


2

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


2

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


2

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


2

A internet search on PHP and projection turned up a PHP port for PROJ.4. proj4php The page says that it's a translation from a Javascript version of PROJ.4. I'm not familiar with it so I can't give you any more details.


2

First of all, because the radius is expressed in meters, you need to convert/transform your data in a projected coordinate system. For instance, if lat and lon are geographic coordinates in WGS84, you could use the UTM WGS84 ...something. Then, I would use this solution: http://math.stackexchange.com/a/256123


2

You can load dynamically (with ajax) your PHP file and set the content into testData var, as in your previous script. Then execute your original script without any changes. Note that you will use $.ajax() jquery method to be able to set 'async': false option. var testData = (function () { var testData = null; $.ajax({ 'async': false, 'global': ...


2

for a quick solution, you can check out shapefile-js. A binary shapefile loader and canvas-based renderer, for javascript. Many caveats. test it: http://www.prodevelop.es/files/fm/public/downloads/jldominguez/shp.html more info: Rendering local shapefiles with HTML5 http://www.prodevelop.es/en/blog/11/12/11/rendering-local-shapefiles-html5 and my ...


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

If you have tiled map in MBTiles format, you can serve them using ordinary PHP script. All you need is php-sqlite module, which should be included by default. You can try this: mbtiles-php - I'm using similar script in production. With some kind of URL-routing library, you can even simulate standard TMS. Actually, you also can write your own WMS ...


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

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

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

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.


1

first , you don't have geometry class in php (i don't know how to get one). Second georaphy is not geometry type in database , those two types are different. WKT for POLYGON seems to be wrong, should be like 'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10)) (thats how i got my test case working) $params = 'geometry::STGeomFromText('POLYGON ...


1

Yes, it is possible. But what is the source of layer list? If that information is stored in a some kind of database, then PHP will be the right way. But when you want to load all layers from WMS server/workspace, then AJAX call to GetCapabilities or GeoServer API will be better. Last but not least, if layer list is immutable, this could be done entirely in ...


1

This is a pure PHP polygon class that offers many geometric operations such as union and intersect. The library is released under GNU license. http://www.phpclasses.org/package/2544-PHP-Perform-geometric-operations-on-polygons.html


1

You may use GeoTools, which is an open source java toolkit, for doing your union/dissolve process, check out this Q/A: combine several polygon objects in one polygon object with geotools (is it possible)?


1

A spatial DBMS is usually (an extension to a) traditional, relational DBMS. It provides At least a Point data type (X, Y) or (lat, long) and often Line and Region types. A spatial indexing option such that queries seeking records that are geo-located within a simple bounding rectangle can be answered quickly. Such databases may also vary according to ...


1

Setting up your own server seems like a lot of work in order to serve a simple map of a small area, especially if you don't already have experience in doing so. I think your time would be much more wisely spent using a hosted web mapping product. You could put a fully featured map together in MangoMap in an hour or two without having to write a single line ...


1

ESRI's geoservice's are also simular to google's. For example fetching a json result for Antwerp: http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=antwerp&f=pjson And they also support multiple languages. More info on: ...


1

If you don't want to code alltogether, you can use QuantumGIS plugins to request data and view results. Cf. the blog of A. Graser for example.



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