Jump to content

 
Photo

MapInfo/MapBasic and Labels!

- - - - -

  • Please log in to reply
4 replies to this topic

#1
20 Ton Squirrel

20 Ton Squirrel

    Newbie

  • Validated Member
  • Pip
  • 6 posts
  • United States

Greetings! I'm working within the latest release of MapInfo and MapBasic (version 10 ). I've found a few MapBasic questions answered here so hopefully someone can help, I'm stumped!

The task before me is to create hundreds of zipcode-level views. I have isolated the zips in a separate table and wrote code that centers the window on each one to take a snapshot (export as jpg).

My problem is the darn labels!

For instance, the state label "NH" is visible for zipcode 00181, but when the code focuses on another zipcode a few miles away it isn't any longer.

Is there a setting or bit of code that forces labels to be shown no matter where the view is?


Here's my code:
Declare Sub Main



Include "MapBasic.def"



Sub Main

  dim strName as string

  dim objPoint As Object

  dim intX As Integer, intY as Integer

  

	Fetch First From advanceUncodedZips

	

	Do While Not EOT(advanceUncodedZips) 

		strName  = advanceUncodedZips.col1



		objPoint = ObjectGeography(advanceUncodedZips.obj, OBJ_GEO_CENTROID)

		intX = ObjectGeography(objPoint, OBJ_GEO_POINTX)

		intY = ObjectGeography(objPoint, OBJ_GEO_POINTY)



		Set Map Center (intX, intY) Zoom (150)



		Save Window FrontWindow() As "C:\USER\views\view_" & strName  & ".JPG" Type "JPEG" Width 8.29167 Units "in" Height 5.625 Units "in" Resolution 96



		Fetch Next From advanceUncodedZips

	Loop

	

	exit sub



ERRCATCH:

	

End Sub


#2
CHART

CHART

    Chart

  • Validated Member
  • PipPipPipPipPip
  • 358 posts
  • No Country Selected

Greetings! I'm working within the latest release of MapInfo and MapBasic (version 10 ). I've found a few MapBasic questions answered here so hopefully someone can help, I'm stumped!

The task before me is to create hundreds of zipcode-level views. I have isolated the zips in a separate table and wrote code that centers the window on each one to take a snapshot (export as jpg).

My problem is the darn labels!

For instance, the state label "NH" is visible for zipcode 00181, but when the code focuses on another zipcode a few miles away it isn't any longer.

Is there a setting or bit of code that forces labels to be shown no matter where the view is?


Here's my code:

Declare Sub Main



Include "MapBasic.def"



Sub Main

  dim strName as string

  dim objPoint As Object

  dim intX As Integer, intY as Integer

  

	Fetch First From advanceUncodedZips

	

	Do While Not EOT(advanceUncodedZips) 

		strName  = advanceUncodedZips.col1



		objPoint = ObjectGeography(advanceUncodedZips.obj, OBJ_GEO_CENTROID)

		intX = ObjectGeography(objPoint, OBJ_GEO_POINTX)

		intY = ObjectGeography(objPoint, OBJ_GEO_POINTY)



		Set Map Center (intX, intY) Zoom (150)



		Save Window FrontWindow() As "C:\USER\views\view_" & strName  & ".JPG" Type "JPEG" Width 8.29167 Units "in" Height 5.625 Units "in" Resolution 96



		Fetch Next From advanceUncodedZips

	Loop

	

	exit sub



ERRCATCH:

	

End Sub


Chart

#3
CHART

CHART

    Chart

  • Validated Member
  • PipPipPipPipPip
  • 358 posts
  • No Country Selected

In your label setting look up the 'label partial object' option. Make sure that feature is checked.
Hope this works. If not, may I suggests you post your request at http://groups.google...group/mapinfo-l

Regards
Chart

#4
gregsd

gregsd

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 169 posts
  • Gender:Male
  • Location:Surrey, England.
  • Interests:Cycling, mostly off-road (MTB) riding.
  • United Kingdom

In your label setting look up the 'label partial object' option. Make sure that feature is checked.
Hope this works. If not, may I suggests you post your request at http://groups.google...group/mapinfo-l

Regards


I'd also recommend that you enable either the 'allow overlapping text' or 'when overlap occurs try another position' options (under the Labeleling Rules tab for the Layer Properties). This will ensure that the label will be displayed if MapInfo 'thinks' that the labels are clashing.

Greg.


Greg Driver

GIS Analyst
MapInfo User...!

#5
20 Ton Squirrel

20 Ton Squirrel

    Newbie

  • Validated Member
  • Pip
  • 6 posts
  • United States

I enabled the "Label Partial Object" option for the respective layers and, by jove, it WORKED. I can pan around and the label for all my regions show up! Selecting the Positioning option solved all the overlapping issues as well.

EXCELLENT! Thank you both for the response!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->