[OpenLayers-Users] Open layers with postgis
Robert Buckley
robertdbuckley at yahoo.com
Tue Nov 15 14:13:01 EST 2011
Sounds easy....any chance you could write a tutorial using simple examples we could build on?
yours
Rob
________________________________
Von: Adam Eskreis <aeskreis at gmail.com>
An: Nicholas Efremov-Kendall <n.e.kendall at gmail.com>
Cc: openlayers-users at lists.osgeo.org
Gesendet: 19:31 Dienstag, 15.November 2011
Betreff: Re: [OpenLayers-Users] Open layers with postgis
Hello Aditya,
I do what you are wanting to do nearly every day at my job. Here are a few tips to help you get started:
1. The first thing you need to do is set up a connection to your PostgreSQL database. Once this is complete, we can get started
2. Next you are going to want to retrieve your data and pass it to the frontend. Assuming you already know how to do a spatial query, I would pull whatever data you want from the database, parse it into an array and echo it out using json.
3. Once you have your json on the frontend, you just loop through the array and plot the data as you need.
4. The geo-data will come back from PostGIS as either Well Known Binary, or Well Known Text, depending on how you chose to retrieve it. WKB is faster, but is harder to parse, and WKT has built in support in OpenLayers. (have a look at the OpenLayers.Geometry.fromWKT function). I recommend pulling in the data as WKT for starting out, and as you get more familiar you can work on writing a WKB parser.
5. If you need help using spatial queries, I would consult the PostGIS guide before continuing wiht anything, however the main functions I would recommen dlooking up are:
distance
within
contains
intersects
astext
These functions will encompass most spatial queries you need to execute.
Hope this helps,
-Adam
On Tue, Nov 15, 2011 at 8:08 AM, Nicholas Efremov-Kendall <n.e.kendall at gmail.com> wrote:
I have an ajax app the querries mysql and returns the results as GML. If you like, I can share the code with you,
>
>
>
>On Tue, Nov 15, 2011 at 2:15 AM, adams <adams at terrestris.de> wrote:
>
>Oh sorry,
>>I apologize, the correct URL is:
>>
>>http://www.openlayers-buch.de/beispiele.php
>>
>>
>>(@Bart 403 only for you - today because of the football match, thanks
>>for the hint)
>>
>>Regards, Till
>>
>>On 15.11.2011 09:08, Bart van den Eijnden (OSGIS) wrote:
>>> Hey Till,
>>>
>>> that URL gives a 403 forbidden.
>>>
>>> Best regards,
>>> Bart
>>
>>>
>>>> Dear Aditya,
>>>>
>>>> there is postgis console, which directly displays queries in OL - this
>>>> is a tool my colleague made for a german OL manual.
>>>>
>>>> See the stuff here:
>>>> http://www.openlayers-buch.de/beispiele/
>>>>
>>>> go to chapter 9 (in germany only, sorry).
>>>>
>>>> You may also download the code from this page.
>>>>
>>>> Regards, Till
>>>>
>>>>
>>>> On 15.11.2011 08:54, Aditya Kumar wrote:
>>>>> Dear USers,
>>>>> I want to display the result of some queries from postgis using
>>>>> php.Can
>>>>> you suggest me some documentation for this so that I can go through them
>>>>> and
>>>>> make my application?
>>>>>
>>>>>
>>>>> Aditya Kumr
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://osgeo-org.1803224.n2.nabble.com/Open-layers-with-postgis-tp6995410p6995410.html
>>>>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> --> GO Mobile - jetzt WebGIS auch auf Smartphones <--
>>>> ! Achtung - terrestris hat eine neue Adresse !
>>>>
>>>> ---------------------------------------------------------
>>>> terrestris GmbH & Co. KG
>>>> Puetzchens Chaussee 56
>>>> 53227 Bonn
>>>> Germany
>>>>
>>>> Till Adams
>>>> Geschaeftsfuehrung
>>>>
>>>> Tel: +49 (0)228 / 962 899-52
>>>> Mobile: +49 (0)151 / 25394429
>>>> Fax: +49 (0)228 / 962 899-57
>>>>
>>>> adams at terrestris.de
>>>> http://www.terrestris.de
>>>> Amtsgericht Bonn, HRA 6835
>>>> ---------------------------------------------------------
>>>>
>>>> Komplementaerin:
>>>>
>>>> terrestris Verwaltungs GmbH
>>>>
>>>> vertreten durch:
>>>> Hinrich Paulsen, Till Adams
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>
>>>
>>>
>>
>>--
>>
>>
>>--> GO Mobile - jetzt WebGIS auch auf Smartphones <--
>> ! Achtung - terrestris hat eine neue Adresse !
>>
>>---------------------------------------------------------
>>terrestris GmbH & Co. KG
>>Puetzchens Chaussee 56
>>53227 Bonn
>>Germany
>>
>>Till Adams
>>Geschaeftsfuehrung
>>
>>Tel: +49 (0)228 / 962 899-52
>>Mobile: +49 (0)151 / 25394429
>>Fax: +49 (0)228 / 962 899-57
>>
>>adams at terrestris.de
>>http://www.terrestris.de
>>Amtsgericht Bonn, HRA 6835
>>---------------------------------------------------------
>>
>>Komplementaerin:
>>
>>terrestris Verwaltungs GmbH
>>
>>vertreten durch:
>>Hinrich Paulsen, Till Adams
>>_______________________________________________
>>Users mailing list
>>Users at lists.osgeo.org
>>http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>
>_______________________________________________
>Users mailing list
>Users at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111115/27f96471/attachment-0001.html
More information about the Users
mailing list