[Routing] render the postgresql query into openlayers (GeoJSON output)
Daniel Kastl
daniel at georepublic.de
Fri Aug 12 02:35:38 BST 2011
What does ./php/closedstreets.php return?
Do you use Firebug to check the AJAX request?
What can you see in /var/log/apache2/error.log?
Daniel
On Fri, Aug 12, 2011 at 5:09 AM, javad sadidi <jsadidi at gmail.com> wrote:
> yes. I will change my questions direction to Openlayers mailing list.
> but I think you are the most skill full person in this case. because you
> wrote the workshop.
> I always test my self at first and while I dont get result , I mail to you.
> but in this case , I dont get any result, there is no error. for example I
> changed the codes according to your email but nothing happens abou
> displaying closed streets on my map.
> I have added the following lines to the pgrouting-final.html file of the
> workshop to display the result of the PHP codes.but for example for the
> Store of the route that shows the result of routing as a line , there is
> some triggers to run its php file. for example when you hit points or move
> them or change the method of routing.
> but for my added codes what is its trigger to execute the related php file.
>
> // create the layer where the Closed streets will be drawn
>
> var closed_streets = new OpenLayers.Layer.Vector("streets", {
> styleMap: new OpenLayers.StyleMap(new OpenLayers.Style({
> strokeColor: "#1589FF",
> strokeWidth: 6
> }))
> });
>
> then
> map.addLayers([points_layer, route_layer, closed_streets]);
>
> and then
>
> / create the new store to query the web service for dispalying the CLOSED
> streets
> var store1 = new GeoExt.data.FeatureStore({
> layer: closed_streets,
> fields: [
> {name: "length"}
> ],
> proxy: new GeoExt.data.ProtocolProxy({
> protocol: new OpenLayers.Protocol.HTTP({
> url: "./php/closedstreets.php",
> format: new OpenLayers.Format.GeoJSON({
> internalProjection: epsg_900913,
> externalProjection: epsg_4326
> })
> })
> })
> });
>
>
> those are all things that I added to the pgrouting-final.html of the
> workshop.
> does it need to trigger to execute the closedstreets.php or it is executed
> automatically?
> is these lines enough to have my query result as lines in the browser?
>
> danke
>
>
>
>
>
> On Thu, Aug 11, 2011 at 4:23 PM, Daniel Kastl <daniel at georepublic.de>wrote:
>
>> Hi Javad,
>>
>> Why don't you just try it and then see if it works?
>> And if it doesn't and you can't find the reason why, then you come back
>> here and tell us the error you get.
>> Btw., you're now more asking questions about OpenLayers than about routing
>> and OSM.
>>
>>
>>
>>> you said me that I have to delete the Properties but I dont know exactly
>>> which lines. please delete the Property in my php code and copy the correct
>>> file for me. and also look to added line in the lines that I added to
>>> display the result of PHP file in the browser. for example if you look to my
>>> added lines you see that I created a new seore(var store1) . is that
>>> right?
>>> why the codes doest work? what was the problem?
>>> thanks
>>>
>>>
>> You could search for "properties" in the PHP code and then you would find
>> it. It's a key/value of the GeoJSON output you want to return.
>>
>> If you don't know what I mean, change your SQL to
>>
>> SELECT gid, ST_AsGeoJSON(the_geom) AS geojson, length(the_geom) AS length
>> FROM ways WHERE ...
>>
>> It should work then as it is.
>> And once again, consider to change to the OpenLayers mailing list if your
>> questions are not related to routing anymore.
>>
>> Daniel
>>
>>
>>
>>> On Thu, Aug 11, 2011 at 4:01 AM, Daniel Kastl <daniel at georepublic.de>wrote:
>>>
>>>>
>>>>
>>>>> .is it ok?
>>>>>
>>>>
>>>> More or less, but you need to to try it yourself. (Remove the
>>>> "properties" from the GeoJSON, because you don't query for them, or add them
>>>> to the query)
>>>>
>>>>
>>>>>
>>>>> then to display it in html file with opn layers: I have to the
>>>>> following steps:
>>>>> 1-create the layer where the query result will be drown
>>>>> 2- add the layer to the map
>>>>>
>>>>
>>>> Yes, it's all described in the workshop. You just need one more layer.
>>>>
>>>> Daniel
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> thanks
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Georepublic UG & Georepublic Japan
>>>> eMail: daniel.kastl at georepublic.de
>>>> Web: http://georepublic.de
>>>>
>>>> _______________________________________________
>>>> Routing mailing list
>>>> Routing at openstreetmap.org
>>>> http://lists.openstreetmap.org/listinfo/routing
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Routing mailing list
>>> Routing at openstreetmap.org
>>> http://lists.openstreetmap.org/listinfo/routing
>>>
>>>
>>
>>
>> --
>> Georepublic UG & Georepublic Japan
>> eMail: daniel.kastl at georepublic.de
>> Web: http://georepublic.de
>>
>> _______________________________________________
>> Routing mailing list
>> Routing at openstreetmap.org
>> http://lists.openstreetmap.org/listinfo/routing
>>
>>
>
> _______________________________________________
> Routing mailing list
> Routing at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/routing
>
>
--
Georepublic UG & Georepublic Japan
eMail: daniel.kastl at georepublic.de
Web: http://georepublic.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/routing/attachments/20110812/b1335d96/attachment.html>
More information about the Routing
mailing list