[pmapper-users] pgrouting

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[pmapper-users] pgrouting

Emmanuel Adegboye
Hi.

I have a working pmapper setup with a postgis database but I want to
incorporate routing using pgrouting. I need users to be able to at least
click both a start and end point on the road network, calculate the route
and display it on a new layer in pmapper. It would be ideal if there is a
search box where users can enter an address for both points.

I'm learning how to implement this using openlayers. Any ideas of how I can
transfer or implement this to pmapper.

I really appreciate your help.

Emmanuel Adegboye
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
pmapper-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/pmapper-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

Armin Burger-2
you should be able to do this relatively easy with p.mapper 5 since this
is built around MapServer and Openlayers. Doing the same for p.mapper 4
is possible but requires more in-depth knowledge how to dynamically add
and remove a layer in p.mapper.

armin


On 12/30/2013 02:55 PM, Emmanuel Adegboye wrote:

> Hi.
>
> I have a working pmapper setup with a postgis database but I want to
> incorporate routing using pgrouting. I need users to be able to at least
> click both a start and end point on the road network, calculate the route
> and display it on a new layer in pmapper. It would be ideal if there is a
> search box where users can enter an address for both points.
>
> I'm learning how to implement this using openlayers. Any ideas of how I can
> transfer or implement this to pmapper.
>
> I really appreciate your help.
>
> Emmanuel Adegboye
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> pmapper-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
pmapper-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/pmapper-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

gioza
In reply to this post by Emmanuel Adegboye
An idea could be using "Pmapper Search function" to get start/end points and in the searchitem SQL using the typical pgrouting syntax?
It works with postgis why not directly in pmapper searchitem?

I'm working on it, I will let you khnow
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

gioza
Update:
my first test seems to work.
I use PMAPPER search tools to select "SOURCE" point then I use a fixed TARGET point in the sql:

<sql>SELECT seq, id1 AS node, id2 AS edge, cost, the_geom   FROM pgr_dijkstra('SELECT id, source, target, st_length(the_geom) as cost FROM sentieri.tutti', ~* '^[search], 2, false, false) as di
  JOIN sentieri.tutti pt
  ON di.id2 = pt.id ;</sql>


in the example SOURCE comes from [search] and TARGET is 2.

it works, it highlights the route! obviously you should use the "network layer" in mapfile but not add it in config.xml. Let it works in backgroung.
Now I would like to "select" the target point in the same way I did for "source" point.
The I would like to use more understandable name for source and target. In this moment they refer to NODE id of my DB created by pgrouting extension.
If someone of you is interested we can develop toghether this function.
it works in pm4 and 5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

gioza
at the end my solution is the following one:

1) create a table with all the possible routes;
2) use search function of pmapper to query my track;
3) use a route layer in background: it is in the mapfile but not in config.xlm; in this way I can use it and see the query results like an highlight;

this is a workaround because I didn't figure out to use dynamically the pgrouting inside pmapper.
I think an advantage is faster reply of server but every time I change a route I have to regenerate my table. Actually it isn't a problem because I create a php ad hoc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

pasquale
sorry for my english. can you show the DATA header of the map file ? I'm trying to reproduce your situation but I have problems with postgis layer. My pmapper_demo.map has:
LAYER
  CONNECTION "dbname='promo_db' hostname=localhost ....."
  CONNECTIONTYPE POSTGIS
  DATA 'geom FROM (SELECT * FROM strade_gal_osm) AS foo USING UNIQUE id USING SRID=23032'
  METADATA
     "RESULT_FIELDS" "id, source, target, st_length(geom) as cost"
     "RESULT_HEADER" "id,source,target,cost"
  END
  ...
In config_default.xml, in searchlist section:
<searchitem name="source" description="source">
  <layer type="postgis" name="strade_gal_osm">
  <field type="n" name="source" description="source" wildcard="0" />
  <sql>SELECT seq, id1 as node, id2 as edge, cost from pgr_dijkstra('SELECT id, source, target, st_length(geom) as cost FROM strade_gal_osm', ~* '^[search]', 27735, false, false) as di JOIN strade_gal_osm pt ON di.id2 = pt.id;</sql>.
when I enter a numeric value in search list pmapper returns only the first record containing the source corresponding to [search] with data header of metadata map file (id, source, target and cost) but no entire route source-target (my case 27735).
Can you help me? I appreciate your help.
Pasquale.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [pmapper-users] pgrouting

gioza
I think that the query in config file works as "WHERE" clause, so it only filters your layer in mapfile.
I figured out creating a table with all my routes and using the search function in config file to filter them as I described in my last post.
Loading...