Re: [OpenMap Users] OpenMap Layer (New)

From: JR Andreassen <janrune_at_io.com>
Date: Tue, 28 Nov 2006 11:50:07 -0600

Hi Rudi...
 This is basically what I'm trying to acomplish.
Though it might work good, I need a bit more generic approach.
How do you deal with massive datasets ?
I have to load all the roads in Texas, which is a 1.5Gig dataset.
So I have to split it up and filter like you do.
The problem is that the data that I get is from different sources and I
can't edit it.
So what I was planning on doing was :

1. Create a filter on the dbf to ignore the columns I dont need.
2. Create a generic labler that takes expressions from the property file
for Label and ScaleFactor
3. Create Generic Labler class that will use the ScaleFactor to filter
and hide.
4. Do the same for the road segments
   JR

>I'm not sure how clean this solution is, but it seamed to do the trick
>for major minor street name filtering according to the current scale...
>
>I created a class that extended ShapeLayer, then added the following to
>the bottom of the prepare() method:
>
>
>
>
>
>if (list != null && !list.isEmpty()) {
> System.out.println("List size : " + list.size());
> try {
> DbfInputStream dbfInput = new DbfInputStream(new
>FileInputStream(dbfFileName));
> String[] colNames = dbfInput.getColumnNames();
> System.out.println("DBF Column Names : " +
>colNames.length);
> for (int x = 0; x < colNames.length; x++) {
> System.out.println("\t-> " + colNames[x]);
> }
> System.out.println("DBF Row Count : " +
>dbfInput.getRowCount());
> ArrayList dbfData = dbfInput.getRecords();
>
> ArrayList dupList = new ArrayList();
> for (int x = 0; x < list.size(); x++) {
> OMGraphic elem = (OMGraphic) list.getOMGraphicAt(x);
>
>
> int dbfIndex =
>((Integer)elem.getAppObject()).intValue();
> dbfIndex--;
>
> int dataIndex = Integer.parseInt(dbfDataCol);
> String data =
>(String)((ArrayList)dbfData.get(dbfIndex)).get(dataIndex);
>
> boolean showLabel = true;
> String postFix = "";
>
> OMTextLabeler label = new OMTextLabeler(data +
>postFix, OMTextLabeler.JUSTIFY_LEFT);
>
> //#### FREEWAYS LAYER
>################################
> if (colNames.length >= 3) {
> if (colNames[2].equalsIgnoreCase("STREETTYPE"))
>{
> String streetType =
>((String)((ArrayList)dbfData.get(dbfIndex)).get(2));
> data = data + " - *" + streetType + "*";
> if (scale < 8500000) {
>
> if
>(streetType.equalsIgnoreCase("Freeway")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Highway")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Route")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Regional")) {
> showLabel = true;
> } else if
>(streetType.trim().equalsIgnoreCase("")) {
> showLabel = true;
> } else {
> showLabel = false;
> }
>
> } else if (scale < 2000000) {
>
> if (streetType.equalsIgnoreCase("Road"))
>{
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Way")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Street")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Bypass")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Drive")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Boulevard")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Avenue")) {
> showLabel = true;
> } else if
>(streetType.equalsIgnoreCase("Throughway")) {
> showLabel = true;
> } else {
> showLabel = false;
> }
>
> } else if (scale < 1000000) {
>
> if
>(streetType.equalsIgnoreCase("Interchange")) {
> showLabel = true;
> } else {
> showLabel = false;
> }
> } else {
> showLabel = false;
> }
> }
>
>
> if (showLabel && !dupList.contains(data)) {
> dupList.add(data);
> showLabel = true;
> } else {
> showLabel = false;
> }
> }
> // #################################################
>
>
> //#### STREETS LAYER ##############################
> if (colNames.length >= 2) {
> if (colNames[1].equalsIgnoreCase("STREET_NAM"))
>{
> label = new OMTextLabeler(data + postFix,
> new java.awt.Font("Arial",
>java.awt.Font.PLAIN, 8),
> OMTextLabeler.JUSTIFY_LEFT);
> if (scale < 20000) {
> showLabel = true;
> } else {
> showLabel = false;
> }
> }
> }
> // ################################################
>
> //#### PROVINCES LAYER ############################
> if (colNames.length >= 1) {
> if (colNames[0].equalsIgnoreCase("PROVINCENM"))
>{
> label = new OMTextLabeler(data + postFix,
> new java.awt.Font("Arial",
>java.awt.Font.BOLD, 15),
> OMTextLabeler.JUSTIFY_LEFT);
> if (scale < 10000000) {
> showLabel = true;
> } else {
> showLabel = false;
> }
> }
> }
> // ################################################
>
> if (showLabel) {
> elem.putAttribute(OMGraphicConstants.LABEL,
>label);
> }
> }
>
>
>
>
>Hi...
>I'm working on making a labeling function in the shape layer.
>There are two problems.
>1. Filtering major/minor streets names. It get's awfully bussy and it's
>hard to see the labels.
>I'm trying to come up with an algo that won't show the label unless the
>length of the label is <= line segment.
>Combined with perhaps a enumeration for major/minor street
>2. Currently the OMLabel/OMTextLabeler only displays the label
>Horizontaly.
>Need to figure out a way to rotate it..
>
>Anyone that have any comments suggestions feel free to comment.
>JR
>
>
>
>>Hi There,
>>
>>Im new the gis environment and would like some help with regards to
>>the following :
>>
>>I'm looking for assistance in displaying a street layer that is in a
>>shp and/or ssx format ( That has been exported from another GIS
>>application ) . I have been able to display the data ( street lines )
>>correctly, but unable to display street names next to the lines. Any
>>help would be appreciated.
>>
>>Thanx
>>
>>Rudi
>>
>>
>>
>
>
>
>
>--
>[To unsubscribe to this list send an email to "majdart_at_bbn.com"
>with the following text in the BODY of the message "unsubscribe openmap-users"]
>
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Nov 28 2006 - 12:52:11 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT