Calculating distance between EsriPoint and EsriPolyline; moving EsriPoint

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Calculating distance between EsriPoint and EsriPolyline; moving EsriPoint

Hyper 4S
Hi all,

I've got two ESRI GIS layers (in the form of shapefiles), one containing
points ("agents"), the other containing polylines ("roads"). From the point
layer, I created Repast agents using the OpenMapData.creatAgents method (as
explained in the GIS tutorial on the Repast website). Next I created an
EsriGraphicList containing the "roads" from the polyline layer (using the
OpenMapData.getEsriLayer().getEsriGraphicList() method).
Now I would like to calculate the nearest road (EsriPolyline) for each agent
(EsriPoint), and subsequently move the agent to that road; but I cant find
out how to do that.
I tried doing this based on the getLat/getLon methods, but they seem to
always return "0.0", both for the EsriPoints and EsriPolylines.
Then I tried doing this based on the "getExtents" methods (which seems to
hold the Lat/lon info instead of the getLat/getLon methods??? Can somebody
give more info about this "extents" field?), and although that works a lot
better (that is, I can find the nearest road based on those data), I'm still
unable to move the agent to the calculated point using EsriPoint.setExtents
(that method simply doesnt work? How come?).

Is this the way to do it? Could someone give me some pointers on how to
solve these problems?

Thanks a lot!

Kristof




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|

RE: Calculating distance between EsriPoint and EsriPolyline; moving EsriPoint

Hyper 4S
Hi group,

I found the solution myself.

The EsriPoint.getLat/getLon methods do NOT return "0.0", but return the
correct values instead. Only EsriPolylines do return "0.0" on invoking
getLat/getLon, but using the getExtents method, their correct values too can
be easily obtained.

For the moving of the point, I now use EsriPoint.set, which works correctly.
I discovered that the setExtents method is actually a dummy method which
does nothing.

Anyway, if someone might still have some suggestions where to find powerfull
geoprocessing methods (finding minimum distance between points, ...), they
are very welcome!
It seems to me that Openmap is rather focused on displaying data, instead of
manipulating data. Java Topology seems to be better at manipulating, but I
dont know how to convert Openmap EsriPoints to Topology Points... Is that
possible?

Thanks,

Kristof

>From: "Hyper 4S" <[hidden email]>
>To: [hidden email]
>Subject: [Repast-interest] Calculating distance between EsriPoint and
>EsriPolyline; moving EsriPoint
>Date: Tue, 15 Nov 2005 10:57:50 +0000
>
>Hi all,
>
>I've got two ESRI GIS layers (in the form of shapefiles), one containing
>points ("agents"), the other containing polylines ("roads"). From the point
>layer, I created Repast agents using the OpenMapData.creatAgents method (as
>explained in the GIS tutorial on the Repast website). Next I created an
>EsriGraphicList containing the "roads" from the polyline layer (using the
>OpenMapData.getEsriLayer().getEsriGraphicList() method).
>Now I would like to calculate the nearest road (EsriPolyline) for each
>agent (EsriPoint), and subsequently move the agent to that road; but I cant
>find out how to do that.
>I tried doing this based on the getLat/getLon methods, but they seem to
>always return "0.0", both for the EsriPoints and EsriPolylines.
>Then I tried doing this based on the "getExtents" methods (which seems to
>hold the Lat/lon info instead of the getLat/getLon methods??? Can somebody
>give more info about this "extents" field?), and although that works a lot
>better (that is, I can find the nearest road based on those data), I'm
>still unable to move the agent to the calculated point using
>EsriPoint.setExtents (that method simply doesnt work? How come?).
>
>Is this the way to do it? Could someone give me some pointers on how to
>solve these problems?
>
>Thanks a lot!
>
>Kristof
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>Register for a JBoss Training Course.  Free Certification Exam
>for All Training Attendees Through End of 2005. For more info visit:
>http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>_______________________________________________
>Repast-interest mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/repast-interest




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|

Re: Calculating distance between EsriPoint and EsriPolyline; moving EsriPoint

Robert Najlis
Kristof,

you are correct that OpenMap is more focused on displaying than
analysis of gis data.  GeoTools and JTS are a bit better at this.
Openmap does have some function for finding distances between points.
If you want to use Geotools/JTS for analysis,you could use OpenMap for
display, and then load the same data into your model as Geotools data
and use the agents made from Geotools for data analysis (a bit kludgey
I know).  Also, you can use ArcGIS, for certain types of data
analysis.  Another possibility might be to use GRASS via the jGRASS
java interface for GRASS.  GRASS would provide analytical capabilities
comparable to ArcGIS. On the downside, the interface between Repast
and GRASS has not yet been programmed, so it would take a bit of work.

- Robert



On 11/15/05, Hyper 4S <[hidden email]> wrote:

> Hi group,
>
> I found the solution myself.
>
> The EsriPoint.getLat/getLon methods do NOT return "0.0", but return the
> correct values instead. Only EsriPolylines do return "0.0" on invoking
> getLat/getLon, but using the getExtents method, their correct values too can
> be easily obtained.
>
> For the moving of the point, I now use EsriPoint.set, which works correctly.
> I discovered that the setExtents method is actually a dummy method which
> does nothing.
>
> Anyway, if someone might still have some suggestions where to find powerfull
> geoprocessing methods (finding minimum distance between points, ...), they
> are very welcome!
> It seems to me that Openmap is rather focused on displaying data, instead of
> manipulating data. Java Topology seems to be better at manipulating, but I
> dont know how to convert Openmap EsriPoints to Topology Points... Is that
> possible?
>
> Thanks,
>
> Kristof
>
> >From: "Hyper 4S" <[hidden email]>
> >To: [hidden email]
> >Subject: [Repast-interest] Calculating distance between EsriPoint and
> >EsriPolyline; moving EsriPoint
> >Date: Tue, 15 Nov 2005 10:57:50 +0000
> >
> >Hi all,
> >
> >I've got two ESRI GIS layers (in the form of shapefiles), one containing
> >points ("agents"), the other containing polylines ("roads"). From the point
> >layer, I created Repast agents using the OpenMapData.creatAgents method (as
> >explained in the GIS tutorial on the Repast website). Next I created an
> >EsriGraphicList containing the "roads" from the polyline layer (using the
> >OpenMapData.getEsriLayer().getEsriGraphicList() method).
> >Now I would like to calculate the nearest road (EsriPolyline) for each
> >agent (EsriPoint), and subsequently move the agent to that road; but I cant
> >find out how to do that.
> >I tried doing this based on the getLat/getLon methods, but they seem to
> >always return "0.0", both for the EsriPoints and EsriPolylines.
> >Then I tried doing this based on the "getExtents" methods (which seems to
> >hold the Lat/lon info instead of the getLat/getLon methods??? Can somebody
> >give more info about this "extents" field?), and although that works a lot
> >better (that is, I can find the nearest road based on those data), I'm
> >still unable to move the agent to the calculated point using
> >EsriPoint.setExtents (that method simply doesnt work? How come?).
> >
> >Is this the way to do it? Could someone give me some pointers on how to
> >solve these problems?
> >
> >Thanks a lot!
> >
> >Kristof
> >
> >
> >
> >
> >-------------------------------------------------------
> >This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> >Register for a JBoss Training Course.  Free Certification Exam
> >for All Training Attendees Through End of 2005. For more info visit:
> >http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> >_______________________________________________
> >Repast-interest mailing list
> >[hidden email]
> >https://lists.sourceforge.net/lists/listinfo/repast-interest
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> Repast-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/repast-interest
>


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
<a href="http://ads.osdn.com/?ad_idv28&alloc_id845&op=click">http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest