Hi Eric,

I’m currently creating a 2048x1024 image of the earth using the Natural
> Earth data set. I need to be able to look at every pixel from my map and
> determine whether or not it is inside a country or group of countries. The
> best way I’ve implemented this so far is by creating a bounding box around
> the country (or group of countries) and then iterating through each pixel
> inside that bounding box (to prevent iterating over the entire world map).
> I convert the pixels to coordinates then call the contains() method to
> determine if the coordinate is within the polygon for the country. This
> method works, but is very slow for some areas, especially if the bounding
> box gets large, which happens if you select many countries or with area’s
> that span the entire globe. There are several groupings that span half or
> most of the world. If I select larger groups or even select all countries
> the checks take an extremely long time to complete.
>
>
>
> Is there a suggested better (more efficient) way to do this kind of task
> with your tools I may have overlooked? I’m still learning the tools here
> and would very much appreciate any feedback or assistance you could give.
>

I would not use a vector map in this case, but a raster mask.
Prepare just once a raster map of the rasterized countries assigning them a
code, of the same size as the image . Then you do the check checking the
code in the same col/row position of the 2 rasters.
Could that work?

Cheers,
Andrea



>
>
> Additionally the bounding box for a country like Fiji from the Natural
> Earth data spans the entire globe (-180 to 180 degrees). Is there an
> approved method of splitting the bounding boxes in that case to reduce the
> area I have to check?
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to